LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2004, 04:58 PM   #1
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Rep: Reputation: 31
bash / sh not working (not recognized?)


I'm trying to run a very simple script file to troubleshoot the issue and I'm getting the following error:

: bad interpreter: No such file or directory

The contents of the file are:

#!/bin/sh
echo "hello"

I've checked in /bin and I have both bash and a symb link to bash as sh. I've checked my path and I have the following:

/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/kde/bin:/usr/lib/qt-3.2.1/bin:/usr/share/texmf/bin

Any suggestions? How can I better troubleshoot this?

Thanks.
Hallamigo

= = = = = = = = = = = = = = = = = = =
Distro: Slackware 9.1
WM: Fluxbox-0.1.14
- - - - - - - - - - - - - - - - - - - - - - -
Dell Inspiron 8200
Intel Pentium 4 Mobile CPU 1.60GHz
256MB RAM - 30 GB HD
Nvidia GeForce2 Go (32 MB)
Crystal WDM Audio
= = = = = = = = = = = = = = = = = = =
 
Old 04-12-2004, 05:11 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
What did you name the file and did you make it executable?

And if the command is executable, is it in your current path? If not put a ./ in front of the command.
 
Old 04-12-2004, 05:23 PM   #3
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Original Poster
Rep: Reputation: 31
Good questions, trickykid.

I've named the file 'test' and it is executable (755).
Running it using ./test I get:

: bad interpreter: No such file or directory

Running it using '/bin/sh test' or '/bin/bash test' I get:

: command not found
hello

BTW, earlier I was getting an extra colon and dot at the end of my path. I fixed this by putting:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/kde/bin:/usr/lib/qt-3.2.1/bin:/usr/share/texmf/bin

in my .bashrc file.
 
Old 04-12-2004, 05:28 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
Have you tried changing your script to be /bin/bash instead of /bin/sh ?
 
Old 04-12-2004, 05:39 PM   #5
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Original Poster
Rep: Reputation: 31
Just did, same results. I ran into this issue a long while back on one of my servers and then it just went away.
 
Old 04-12-2004, 07:08 PM   #6
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Original Poster
Rep: Reputation: 31
Got it! Thanks to this thread http://www.linuxquestions.org/questi...hreadid=136201 I was reminded of the issue I had before. I backed up these files to a Windows box and when I brought them back over Windows had changed the EOLs in the files making it so Linux couldn't read them - hense my error. Creating a fresh shell file or saving the file with a Linux editor fixed the issue.

Thanks all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB keyboard recognized but not working on 2.6.8 joyman555 Linux - Hardware 4 04-08-2005 11:41 PM
Dialog command not recognized on debian sarge's bash!!! CM019 Linux - Newbie 2 02-13-2005 04:37 PM
getting cdrw hdd recognized and working bearon50 Slackware - Installation 10 04-08-2004 12:32 PM
Sidewinder recognized, but not working properly. Locura Linux - Hardware 2 08-08-2003 02:55 AM
Sidewinder recognized, but not working properly. Locura Slackware 0 07-07-2003 09:46 PM


All times are GMT -5. The time now is 10:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration