I am getting the same not found [No such file or directory] error when trying to execute a ksh script. Read tips about the PATH and running the script with a ./ in the posts here and here and tried but no luck. The script does exist under the directory from where I am trying to execute and has full permissions but gives the same error when run directly or with a ./. The first line within the script also has #!/usr/bin/kshThe error message is like below:-ksh: revenue_ext.ksh: not found [No such file or directory]However, other ksh scripts under the same directory run fine so am absolutely clueless about what could be wrong here. Any help would be greatly appreciated
-ksh: revenue_ext.ksh: not found [No such file or directory]
shell script;ksh;executable
I believe there may be some carriage returns causing this error here. I was able to reproduce the error successfully. Testingcat ksh_experiment.ksh#!/usr/bin/kshecho HelloNow after providing the permissions when I ran the file, it produced the output successfully. Now as discussed over here, I inserted some carriage returns in my file. Now when I ran the script, I was getting the output as,ksh: ./ksh_experiment.ksh: not found [No such file or directory]Now, cat -v ksh_experiment.ksh too produced the same output. Also, if I typed vim ksh_experiment.ksh , a new file was getting opened. As discussed in the answer of the link that I provided, I removed the carriage returns using the command, perl -p -i -e s/\r//g ksh_experiment.kshAfter fixing when I ran, I got the output as expected. 