Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 01-12-2006, 04:31 PM   #1
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

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.

Old 01-12-2006, 07:06 PM   #2
LQ 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.


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

All times are GMT -5. The time now is 12:25 PM.

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