I have a bash script and want to write something in it for use in the next time:
#this get the full path of the script
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/$(basename $0)"
NUMBER=10
#This change only in the first occurrence
cat "$SCRIPT" | sed "1,/NUMBER=../s/NUMBER=../NUMBER=$((NUMBER + 1))/" > "$SCRIPT"
The problem I am having is that it produce an empty file. Can I overwrite my bash script in your own code?