1834935 Members
2488 Online
110071 Solutions
New Discussion

Re: set -x

 
brian_31
Super Advisor

set -x

I have put set -x in my script to find why it fails via cron and i get this
crontab: error on previous line; unexpected character found in line.
crontab: errors detected in input, no crontab file generated.

when i do vi i do not see any unexpected characters. how do i see it? why does set -x complain that way. i have set -x as the first line.

Thanks

Brian
5 REPLIES 5
Ralph Grothe
Honored Contributor

Re: set -x

In vi try

Esc:set list

or try

cat -v /suspicious/file

or

od -c /suspicious/file
Madness, thy name is system administration
Oviwan
Honored Contributor

Re: set -x

Hey

in the first line of the script you have to set
#!/usr/bin/ksh or #!/usr/bin/sh or whatever and then set -x

Regards
Steve Steel
Honored Contributor

Re: set -x

Hi


Indeed

#!/bin/ksh
set -x


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steven E. Protter
Exalted Contributor

Re: set -x

Shalom Brian,

I think set -x should be in the script, not the crontab file.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sandman!
Honored Contributor

Re: set -x

you might have invisible or non-printing characters in your file. Do "cat -vt filename" to see if that's the case.