0

我当前的 bash 脚本是:

#!/bin/bash

# Variables
fileloc="/home/jerry/scripts/widget"

# Backup file first
cp $fileloc $fileloc.backup

widedit=`(yad --title="Linux Lite - Widget Editor" --borders=20 --text="All fileds <span font='Roboto Bold 12'>MUST</span> have a value:\n" --form \
--field="Gap X (0 - total monitor width span in pixels): ":NUM '!0..100000!1' \
--field="Gap Y (0 - total monitor height span in pixels): ":NUM '!0..100000!1' \
--field="Transparent (yes or no ):":CB yes!no! \
--button=gtk-apply:0)`

# Write to configuration file

echo $widedit | awk '{ sub(/gap_x/,"gap_x "$1); print }' >> $fileloc
echo $widedit | awk '{ sub(/gap_x/,"gap_x "$2); print }' >> $fileloc
echo $widedit | awk '{ sub(/gap_x/,"gap_x "$3); print }' >> $fileloc

exit 0

我希望在/home/jerry/scripts/widget中显示gap_x 65的行来读取我输入到 yad 框中的值,然后覆盖小部件文件中的现有值。在这一点上,我被困住了。先感谢您。

4

0 回答 0