Hello,
Is there some way to validate a bash script before running it. I want to make sure all of the syntax and everything is good so that I dont get a false return code.
Thanks,
tom
Hello,
Is there some way to validate a bash script before running it. I want to make sure all of the syntax and everything is good so that I dont get a false return code.
Thanks,
tom
bash -n /path/to/script
Hello,
Another smart way is to set a debugger like
set -x
in your code at the beginning. and step through the exectution.
Regards
set -x does run the code; that's not what the OP asked for.
Hello sir, cfajohnson
He said to validate, that could show where he could find it going wrong through stepping through the execution. That was merely another way to go through it.
Regards.
Merry Christmas
What he asked for was to "validate a bash script before running it". To do that, bash -n (or set -n) is needed; set -x prints what is being run.
You win .
thanks, I should have read the man page better :-p