#!/bin/bash cannot find file or directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting #!/bin/bash cannot find file or directory
# 1  
Old 12-12-2011
#!/bin/bash cannot find file or directory

Hello,

When i run a bash script on ubuntu i get this message..

Code:
#!/bin/bash cannot find file or directory...

Can anibody help me with this, because the file actually exists....

Is there any extra configuration to be made?

Last edited by methyl; 12-12-2011 at 06:44 PM.. Reason: added code tags to error message
# 2  
Old 12-12-2011
Can you post a sample of this bash script between CODE tags, please?
# 3  
Old 12-12-2011
First make sure that you used a unix editor to create the script and not something like Microsoft Notepad.

To visually check the format of the file, this "sed" command makes control codes visible. A normal unix text file will show just a dollar sign at the end of each line. A Microsoft format text file will show "\r$" at the end of each line - and it will not work as a shell script file.

Code:
sed -n l name_of_your file

# 4  
Old 12-12-2011
Is there actually a bash in /bin? (Maybe it's in /usr/bin, or maybe /bin/bash is a link to someplace from where bash was deleted.)
# 5  
Old 12-12-2011
This error message is usually because something is wrong with the Shebang line.
# 6  
Old 12-13-2011
I don't have access to the script now, but i'll try to change it to #!/usr/bin/bash...
thanks for you're help, ill give feedback as soon as i canSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting error: /usr/bin/env: ruby: No such file or directory

Hi, I installed ruby using rvm with root user on Linux. Now i m trying the below command as a non root user with sudo privileges. sudo /usr/local/rvm/rubies/ruby-2.2.5/bin/gem install passenger I get the below error: I had even reset the path for both gem as well as ruby as you... (8 Replies)
Discussion started by: mohtashims
8 Replies

2. Red Hat

Chroot: cannot execute /bin/sh: No such file or directory

Hi Expert, I'm having grub problem here: grub> root (hd0,0): Filesystem type is ext2 grub> setup Error 11 : Unrecognized Device String I try install boot loader follow the instruction from 26.2. Booting into Rescue Mode It says : select Continue, it attempts to mount your file... (4 Replies)
Discussion started by: justbow
4 Replies

3. Shell Programming and Scripting

Usage of #!/bin/sh vs #!/bin/bash shell scripts?

Some question about the usage of shell scripts: 1.) Are the commands of the base shell scripts a subset of bash commands? 2.) Assume I got a long, long script WITHOUT the first line. How can I find out if the script was originally designed für "sh" or "bash"? 3.) How can I check a given... (3 Replies)
Discussion started by: pstein
3 Replies

4. Shell Programming and Scripting

-bash: ./p4: /bin/ksh^M: bad interpreter: No such file or directory

I keep getting this error and I am not sure why. -bash: ./p4: /bin/ksh^M: bad interpreter: No such file or directory First I run my makefile and this works fine: goodmain: main.o gcc -o goodmain main.o main.o: main.c gcc -c main.c Then I want to limit my output so I... (11 Replies)
Discussion started by: cokedude
11 Replies

5. Solaris

/bin/find: stat() error <File> : No such file or directory

Hi, I am getting below error in Solaris 10 SPARC when trying to issue a search on /var/tmp partition Below is the query /bin/find /var/tmp/ -type f -atime +1 Below is the result /bin/find: stat() error <File> : No such file or directory (28 Replies)
Discussion started by: prash358
28 Replies

6. UNIX for Dummies Questions & Answers

How do I run a .bin file in another directory in a script?

The way this works from the command prompt is: ___________________________________________ cd /data/local/bin chmod 0755 file.bin ./file.bin _______________________________________________ How do I make this happen in a script. The file must be run in its directory but I can not get the... (2 Replies)
Discussion started by: chrstdvd
2 Replies

7. UNIX for Advanced & Expert Users

#!/usr/bin/env : perl no such file or directory

hi i have some perl scripts with shebang line as (#! /usr/bin/env perl ) instead of actual absolute path of perl ( i know why its that way ) everything works fine from command line , the problem is when i am trying to run those scripts from web ( local web tool ) it throws error as /usr/bin/env :... (6 Replies)
Discussion started by: zedex
6 Replies

8. Shell Programming and Scripting

How to find whether a file is transferred thro bin or ascii mode?

Hi Gurus, I need to find out, if i have transferred a file from ftp thro bin mode or ascii mode. Say if i have a file called "dec.sh"( u shuld normally transfer thro ascii mode). How can i find out that dec.sh is tranferred from ftp server thro ascii mode or bin mode? Any help would be... (9 Replies)
Discussion started by: Ashok_oct22
9 Replies

9. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies

10. UNIX for Dummies Questions & Answers

/bin/sh: /usr/bin/vi: No such file or directory when doing crontab

I just set up an ftp server with Red Hat 5.2. I am doing the work, I'm baby stepping, but it seems like every step I get stuck. Currently, I'm trying to set up a crontab job, but I'm getting the following message: /bin/sh: /usr/bin/vi: No such file or directory. I see that vi exists in /bin/vi,... (3 Replies)
Discussion started by: kwalter
3 Replies
Login or Register to Ask a Question