Thanks for reply.
I loaded script in vim, didn't see any "^M" at the end of lines.
Then i run dos2unix to script. it converted successfully but when i tried running script, it abnormally exit my shell (no exit @ end of script).
then i tried option 2("head <filename> -n1 | od -c"). i saw "\r \n" at the end. i tried running sed -i 's/\r//g' <filename> to another copy of script and again my shell abnormally exited.
my script starts with "#!/usr/bin/ksh" but pls explain what is difference in these.
ksh is installed and my user's default shell is ksh.
Please help me out.
Originally Posted by jschiwal
Load the script in vim. If you see "^M" at the end of the lines, then run dos2unix to convert the script to use \n newlines instead of return&linefeed (\r\n).
You could use "head <filename> -n1 | od -c" to check the file manually. If you see "\r\n" at the end, you can use:
sed -i 's/\r//g' <filename>
to convert the script.
Also check the first line of the script. Does is start with "#!/usr/bin/ksh" or "#!/bin/env ksh". If not add this line. If your default shell is bash, you will see errors trying to run a ksh script.
Also make sure that the target system has ksh installed.