1833863 Members
2276 Online
110063 Solutions
New Discussion

Re: set -n

 
SOLVED
Go to solution
Hunki
Super Advisor

set -n

I need to debug a prod script and not execute it and when I put in a "set -n " for that it comes back to the prompt. Is there something wrong or do I need to do something else.
7 REPLIES 7
Sandman!
Honored Contributor
Solution

Re: set -n

Nothing wrong the set -n command is behaving as expected.
James R. Ferguson
Acclaimed Contributor

Re: set -n

Hi:

Well, if nothing is returned, then syntatically the script is correct. You probably want to add 'set -v' and 'set -x' to verbosely show the execution. You can do:

# sh -v -x ./myscript 2>&1 | more

Regards!

...JRF...
Hunki
Super Advisor

Re: set -n

so if it comes back to the prompt ...the syntax of the script is fine .. but how do I get a more descritive output.
Hunki
Super Advisor

Re: set -n

so if it comes back to the prompt ...the syntax of the script is fine .. but how do I get a more descriptive output.
Peter Godron
Honored Contributor

Re: set -n

HI,
if you don't execute the script, how are you going to debug ?

set -n will not execute the script, but will also not give you any debug info.

set -x to debug, but this WILL execute the script.
Sandman!
Honored Contributor

Re: set -n

What do you mean by a more descriptive output. You can always append the "-v" token to the set command "set -nv" and run your script again.
Dennis Handly
Acclaimed Contributor

Re: set -n

Adding set -n is useless because you have to edit the script twice. Instead use:
sh -n script