rtorrent+dtach+zenity

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

rtorrent+dtach+zenity

#1

帖子 eexpress » 2009-08-05 20:48

适合tty和gui。

代码: 全选

☎ cat rt
#!/bin/bash

s='/tmp/dtach-rtorrent'
if [[ $(tty) =~ dev ]]; then t=1; else t=0; fi

if [ -e $s ];then       #连接进程
if [ $t -eq 1 ]; then dtach -a $s; else xterm -e dtach -a $s; fi
exit 0;
fi

#启动确定
if [ $t -eq 1 ]; then
        echo "rtorrent没有启动,需要启动?(y)"
        read -n 1 x
        if [ $x != "y" ]; then exit 1; fi
        echo "产生dtach进程"
        dtach -n $s rtorrent
else
        zenity --question --text="rtorrent没有启动,需要启动?"
        if [ $? != "0" ]; then exit 1; fi
        zenity --info --text="产生dtach进程" --timeout=1
        xterm -e dtach -n $s rtorrent
fi
● 鸣学
回复