4/1/13

Unix ksh won't execute and gives error 127

If you get the error : 127 when you execute the shell script.

There might be one of these 2 issues :

1) shebong line is wrong
2) you might have copied the file from windows to unix - that will create a control/special characters at end of the line.

SOLUTION :
execute the below command

head script.ksh | cat -vet | head -1

If you see "^M" at the end of the output - then you need to remove that special character by either using "dos2unix" command or using cat command like below :

1)  cp padaddwip.ksh padaddwip.ksh.bak
     dos2unix padaddwip.ksh.bak > padaddwip.ksh

2)  cat script.ksh.bak | tr -d "\r" > script.ksh

0 comments:

Post a Comment