LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-12-2006, 03:31 PM   #1
farooqmaniar
LQ Newbie
 
Registered: Jan 2006
Posts: 1

Rep: Reputation: 0
Post problem executing user created scripts on console


Hello Everyone,

I am facing a strange problem in RHEL4. I am trying to write and execute a simple script on console but not able to execute that script.

Script file contains

echo hi

if I try to excute the script in GUI environment I am able to execute it successfully. Also I am able to execute the script using telnet session.

But if i am at console and execute the following command
it just does nothing and does not even come out on the shell, I have to press cntrl + c to come out on shell again.

the command i execute at all the places is ./hi
('hi' is the filename). this works with telnet and gui but not on console. Also strange thing is that if I add the below mentioned line at the begining of the file

#!/bin/sh
then it seems to work fine. I just wanted to know is there any path that I need to set for console to make it work. I am not interested in adding the above mentioned line because my actual files are too many.

thanks,
farooq
 
Old 01-12-2006, 06:06 PM   #2
Half_Elf
Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 45
the "#!/bin/sh" should be used in every shell script usually. It tell the shell that the file you are trying to execute is actually a shell script. You should always have this (to avoid that kind of problem)
I'm not really sure why it fails to execute in console, make sure your shell is actually the one pointed by "/bin/sh" symlink. If the shell you use and the one pointed by /bin/sh are different, it could cause that kind of problem I believe.
 
  


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
CGI Scripts not executing, pls help john_d13 Linux - General 3 12-22-2004 02:05 PM
problem executing scripts on mounted fat32 partition roald Linux - General 8 06-14-2004 06:02 AM
Executing scripts upon login jungatheart Linux - Newbie 3 04-19-2004 06:06 PM
Executing Shell Scripts? l0f33t Linux - General 7 08-17-2003 03:36 PM
Executing shell scripts justinv Linux - General 6 01-26-2003 07:57 AM


All times are GMT -5. The time now is 07:14 PM.

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