分页: 1 / 1

帮忙看看这个闹钟功能怎么出问题了

发表于 : 2013-08-11 9:34
anth
ring(){
song="/media/data/home/videos/mv/*天璇*mp3"
cmd="mplayer -softvol-max 1000 -volume 80 -loop 0"
#echo gnome-terminal -x "$cmd" "$song " | at "$@"
echo "$cmd" "$song " | at "$@"
}

这样改bash 然后使用的时候能够 ring 07:55 设置闹钟 这个可以用 但是我想要的是
那个#号那一行 带了控制窗口就出错了 根本就没有闹钟功能 除非不要gnome-terminal
那样是可以的 为什么啊
anth@cn:~$ ring now
warning: commands will be executed using /bin/sh
job 172 at Sun Aug 11 09:33:00 2013
anth@cn:~$ atq
anth@cn:~$

Re: 帮忙看看这个闹钟功能怎么出问题了

发表于 : 2013-09-11 0:20
needle
:em05
now……
然后atq…

gnome-terminal属于GUI程序,如果想要在系统后台任务中执行需要加DISPLAY变量。
执行方法不如直接执行脚本,把命令行参数再传给方法吧 或者 不写成方法也行。

代码: 全选

ring(){
cmd="mplayer -softvol-max 1000 -volume 80 -loop 0"
song="/media/data/home/videos/mv/*天璇*mp3"
echo "DISPLAY=:0 gnome-terminal -x $cmd $song" | at "$@"
}