0

My current bash script is:

#!/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

I'm wanting to have the line in /home/jerry/scripts/widget that shows gap_x 65 to read the value I input into the yad box, then overwrite the existing value in the widget file. At this point I am stuck. Thank you in advance.

Toto
  • 89,455
  • 62
  • 89
  • 125
sh_newbie
  • 1
  • 2
  • 1
    Check your script with https://shellcheck.net first. `then overwrite the` to overwrite use `>`, `>>` is for appending. – KamilCuk May 19 '21 at 12:35
  • Once you've fixed the issues that `shellcheck` tells you about, if you still have a question then post your corrected code along with concise, testable sample input and expected output so we can help you. – Ed Morton May 19 '21 at 14:55

0 Answers0