[英]how to use yad in bash scripting?
so i am writing a small bash script to automate a few tasks...and i have stumbled on to a issue here.. my problem is 所以我正在写一个小的bash脚本来自动化一些任务...而我在这里偶然发现了一个问题..我的问题是
val=$ ( yad --center --width=300 --height=100 --title "Alert" --image "dialog-question" --buttons-layout=center --text "Search for Broadcast Stations ?" \ --button=gtk-yes:0 --button=gtk-no:1 )
if [[ $val == 0 ]]; then
The Above piece of code is not working out ... what i am trying to do here is save the exit code of the YAD window to the val variable then use it in the if then statement.... what mistake am i doing here ???? 上面的代码无法解决...我想在这里做的是将YAD窗口的退出代码保存到val变量中,然后在if then语句中使用它。 ???? i know the exit status check is $?
我知道退出状态检查是$吗? but i am totally lost on how to actually implement it though ..!!
但是我完全迷失了如何实现它.. !!
This is a full working example based on YAD Wiki examples : 这是一个基于YAD Wiki示例的完整示例 :
val=$(yad --center --width=300 --height=100 --title "Alert" --image "dialog-question" --buttons-layout=center --text "Search for Broadcast
Stations ?" --button=gtk-yes:0 --button=gtk-no:1 )
ret=$?
[[ $ret -eq 1 ]] && echo "No clicked" && exit 0
if [[ $ret -eq 0 ]]; then
echo "Yes clicked"
exit 0
fi
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.