I was running a script and got the error: ./run.sh: line 21: $1: unbound variable
Here it is
# Make sure we have something to run
**if [ "$1" = "" ]; then
** log "Usage: $0 program [args]"
exit 1
fi
Any help would be greatly appreciated!
I didn’t write the code and I have no experience, so I don’t even know where to start.
2
Answers
Remove
set -u
(short syntax) orset -o nounset
(long syntax) from your not shown code.From
help set
:If you didn’t write the script and have no intentions of fixing it, assume it’s not handling the errors in a great way and, in this case, just provide the argument expected (which perhaps you know)