2016-01-08 59 views
0

我有三个shell脚本,我想在yad中单击按钮后运行每个脚本 - 可以说 - 我有一个yad会话并带有三个按钮 - 如果我点击一个按钮我会打开1.剧本 - 第二个按钮打开2.脚本等.. 见我的例子波纹管 -在点击按钮后运行Shell脚本 - YAD

#!/bin/bash 
files=$(yad --width 100 --height 100 --title "Choose the Shell Script" \ 
    --text=" Please enter analysis details:" \ 
    --button="ShellScript1:2" \ 
    --button="ShellScript2:3" \ 
    --button="ShellScript3:3" \ 
    --button="Cancel:1" \ 
    --on-top \ 
    --center \ 
) 

ret=$? 
[[ $ret -eq 1 ]] && exit 0 

谢谢你的任何想法或帮助。

回答

0

我只是补充条件:

ret=$? 

[[ $ret -eq 1 ]] && exit 0 

if [[ $ret -eq 2 ]]; then 

     /path/to/shell/1.sh 
fi 

if [[ $ret -eq 3 ]]; then 

    /path/to/shell/2.sh 

fi