LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-11-2003, 11:09 PM   #1
chuck77
Member
 
Registered: Nov 2001
Location: singapore
Posts: 120

Rep: Reputation: 15
shell script enquiry


I have wrote a shell script. This script works when i left
out the "#!/bin/sh". When i include "#!/bin/sh", it just can't
run. Any expert can kindly advise. Thanks..

*********************************************

#!/bin/sh
a=abc
b=def
c=
if [[ $c = "" ]]
then
echo same
fi


list=`find . -mtime 0 -print`
for j in $list
do
if [[ $j != "." ]]
then
echo $j
echo file name
fi
done

***************************************************
 
Old 06-11-2003, 11:51 PM   #2
awdoyle
Member
 
Registered: Aug 2002
Location: Portland, OR
Distribution: Xubuntu
Posts: 135

Rep: Reputation: 15
I think you need a space between the #! and the /bin/sh
 
Old 06-12-2003, 01:49 AM   #3
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
The #!/bin/sh simply points to where ever sh lives. If it's not there, the default shell is will execute your script.
 
Old 06-12-2003, 08:16 AM   #4
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789

Rep: Reputation: 30
Quote:
Originally posted by rmartine
The #!/bin/sh simply points to where ever sh lives. If it's not there, the default shell is will execute your script.
Exactly. Without knowing what distro Chcuk777 uses, we have no way of knowing what the default shell is, although most distro's use Bash. Chuck, I bet if you try #!/bin/bash instead of #!/bin/sh it will work.

slight
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM


All times are GMT -5. The time now is 09:05 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration