No Such File Or Directory Unix Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
No Such File Or Directory Linux Shell Script
Business Learn more about hiring developers or posting ads with us Unix & Linux Questions unix no such file or directory but file exists Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD no such file or directory bash script and other Un*x-like operating systems. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top #!/bin/bash
Shell Script No Such File Or Directory Error
- no such file or directory up vote 26 down vote favorite 10 I've created a bash script but when I try to execute it, I get #!/bin/bash no such file or directory I need to run the command: bash script.sh for it to work. How can I fix this? bash shell-script executable shebang share|improve this question edited Jan 18 '14 at 23:43 Gilles 373k696781128 asked Dec 17 '11 at 15:25 Nicolas de Fontenay 95641117 add
Linux No Such File Or Directory But Directory Exists
a comment| 6 Answers 6 active oldest votes up vote 41 down vote accepted Usually, this kind of message is due to an extra carriage return at the end of the first line. Run $ head -1 yourscript | od -c and see how it ends: This is wrong 0000000 # ! / b i n / b a s h \r \n This is correct: 0000000 # ! / b i n / b a s h \n Use dos2unix to fix your script if this is the issue. share|improve this answer answered Dec 17 '11 at 17:09 jlliagre 30.6k35490 Another way of revealing if this is the problem is hexdump -C yourscript | head -n 1. I would still use dos2unix yourscript to fix it. –Kevin M Dec 17 '11 at 23:32 Yes it could very well be that. I edited in on windows. Things for the tip. –Nicolas de Fontenay Dec 18 '11 at 2:17 It's totally that :/ Thanks a lot! –Nicolas de Fontenay Dec 19 '11 at 0:12 If it were a CRLF problem, you wouldn't see a #!/bin/bash no such file or directory error message, as there's no reason anything would try to execute or open #!/bin/bash. It's /bin/bash
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of linux no such file or directory but file exists this site About Us Learn more about Stack Overflow the company Business Learn
No Such File Or Directory In Linux
more about hiring developers or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question _ ksh not found [no such file or directory] Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute: Sign up Here's how it http://unix.stackexchange.com/questions/27054/bin-bash-no-such-file-or-directory works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Shell script error (: not found [No such file or directory]) [duplicate] up vote 4 down vote favorite 1 This question already has an answer here: Shell script works when saved with nano but not when saved with Notepad++ 2 answers I'm using following script http://unix.stackexchange.com/questions/224187/shell-script-error-not-found-no-such-file-or-directory on linux server. And which is giving: : not found [No such file or directory] This is the script: # ------------------------------------------------------------------ # K.Sugunan Host health check # Description # # This script to initiate health check on servers. # It will check for CPU, memory and some connectivity with # up stream and down stream system. # # ------------------------------------------------------------------ # Applying initial variables and loading config parameters DOCROOT=$(pwd)"/" TIME_NOW=$(date +"%Y-%m-%d %H:%M:%S") echo $DOCROOT . $DOCROOT"config/main.sh" . $DOCROOT"config/web.sh" . $DOCROOT"config/telnet.sh" echo $CPU_A The error will be like follows: : not found [No such file or directory] : not found [No such file or directory] /home/sugunan/phobos/ : not found [No such file or directory] : cannot open [No such file or directory]os/ I use following ways to run the script ksh poc.sh sh poc.sh ./poc.sh All of the above giving similar error. Even I include #!/bin/bash still the error exist. I have tried #!/bin/ksh and #!/usr/bin/ksh also. All of that gives the error. What may be the reason for the issue on this server? bash shell-script windows newlines share|improve this question edited Aug 19 '15 at 21:28 Gilles 373k696781128 asked Aug 19 '15 at 11:49 sugunan
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies http://unix.stackexchange.com/questions/134581/ksh-revenue-ext-ksh-not-found-no-such-file-or-directory of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question http://stackoverflow.com/questions/19493591/shell-script-error-no-such-file-or-directory _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute: Sign up Here's no such how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top -ksh: revenue_ext.ksh: not found [No such file or directory] up vote 3 down vote favorite 1 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 no such file 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/ksh The 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 shell-script ksh executable share|improve this question edited Jun 5 '14 at 23:10 Gilles 373k696781128 asked Jun 5 '14 at 3:51 user68112 23125 What is the output of cat -v revenue_ext.ksh? –Ramesh Jun 5 '14 at 4:00 If you have moved this file from windows to unix Then run dos2unix filename filename command –sonal May 31 at 8:18 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted I believe there may be some carriage returns causing this error here. I was able to reproduce the error