这是我的代码:
Edit_Record(){
zenity --width=600 --height=300 --text-info --title="Records" --filename=$FILE --editable
if [ "$?" = 0 ]; then
kdialog --title "Saving the Data" --warningyesnocancel "Do you want to save the changes?"
if [ "$?" = 0 ]; then
kdialog --msgbox "The changes have been added!"
Home;
elif [ "$?" = 1 ]; then
kdialog --msgbox "No changes has been added!"
Home;
else
Home;
fi;
else
zenity --info --text "You chose to Cancel."
exit
fi;
}
我不知道在“ kdialog --msgbox”添加了更改!“ :(请帮忙吗?
zenity --editable
将编辑后的文本返回到标准输出。您可以通过重定向将其保存到临时文件中,如果用户要保存更改,只需将临时文件移到原始文件上即可。
tmp=$(mktemp)
zenity --editable ... > $tmp
if ... ; then
mv $FILE "$FILE"~
mv $tmp "$FILE"
fi
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句