[NTLUG:Discuss] set -x not working! was: what is ":bad option"?
Kevin Brannen
kbrannen at gte.net
Sun Jul 23 13:17:24 CDT 2000
m m wrote:
>
> Hi all:
> I have tried:
>
> set -x
> #!/bin/sh -e
Not good. The "#!/bin/sh" must be your first line.
>
> if I try:
>
> #!/bin/sh -x
>
> still get :bad option.
> the following is the code.
Works for me. For example create a file called "try", make it exectable, with
the contents of:
#!/bin/sh -x
echo hello
ls
When you run it, you'll see:
+ echo hello
hello
+ ls
<ls output>
Those lines that start with the "+" are the traced commands. If that doesn't
work for you, I'd question whether /bin/sh is really bash.
>
> #!/bin/sh -e
There is no "-e" option in my man page. Change the "-e" to "-x".
As Cameron also pointed out, you can do:
#!/bin/sh
set -x
<rest of script>
Kevin
More information about the Discuss
mailing list