我正在尝试为工具构建基于终端的GUI。以下代码调用了这样的内容
while true
do
CHOICE=$(dialog --keep-window --clear --no-shadow \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
#*) exec vim "$(echo $CHOICE | cut -d ':' -f 1)" ; ;;
*) filename="$(echo $CHOICE | cut -d ':' -f 1)"
#mkfifo "$TOMATO_DIR/cf"
if [ ! -z $filename ] ; then
dialog --editbox $filename 60 80
#cp "$TOMATO_DIR/cf" $filename
#rm -f ${INPUT}
else
clear
exit 0
fi
clear ;;
esac
done
我尝试打开文件,vim
但保存文件后,工具退出了。
我想知道如何在保存或退出时打开文件并返回到工具vim
?
exec是按bash
手册页内置的外壳程序(请耐心等待,它很远)
exec [-cl] [-a name] [command [arguments]]
If command is specified, it replaces the shell. No new process is created.
考虑2个脚本
exec ls
pwd
和
ls
pwd
如果执行第一个外壳程序,exec ls
命令将替换外壳程序(丢弃剩余的输入),pwd
命令将永远不会执行。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句