Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-16-2004, 11:57 PM   #1
LQ Newbie
Registered: Dec 2004
Location: Sweden
Distribution: Fedora
Posts: 5

Rep: Reputation: 0
How to run SHELL script


I use Linux Fedora Core 3 on a Laptop

I want to run a shell script "" , but it does not work.

1. I try to run from Terminal window entring in command line

Bash answer - unknown command

2. I try to run

Bash answer - unknown command

The script looks like:
echo "My test script"
ls - l

So I changed to super user and tried the same with the same result

Then I run a set command and seen that the variable SHELL=/bin/bash

My next try was to change the first line into


but it does not helped at all.

Since I am rather new in linux world I would like to get some help to what is that I am doing wrong

Old 12-17-2004, 12:03 AM   #2
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96

To run a script or program in the current directory, do ./

Old 12-17-2004, 01:43 AM   #3
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Also make sure the file has executable permission. You can do that with:
chmod u+x
Old 12-17-2004, 02:36 AM   #4
LQ Newbie
Registered: Dec 2004
Location: Sweden
Distribution: Fedora
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the info...

Yes it looks like Dave gave mi answer I needed.

I needed ./ in order to specify curren directory.

Thanks again, now I cen continue to play around.

Old 12-17-2004, 03:05 AM   #5
Registered: Nov 2004
Location: Slovak republic - Bratislava
Distribution: debian & gentoo
Posts: 43

Rep: Reputation: 15
Hmm, You should study something about Your PATH variable.
This is quite different from other OS, becouse You can not run program directly when You do not specify You want to run it in current directory.
It is becouse of security reasons. Imagine, if some "hacker" puts a shellscript named "ls" into /tmp, something like this:

echo "Haha I got u!";
rm -rvf /

You as "root" came to /tmp and type "ls". ;-) Not very good idea. Bud, we are in linux, so You can modify your PATH variable, can add ./ there If You know what You are doing.


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
Run Shell Script on logon thesystem Debian 2 10-20-2005 11:11 AM
run shell script on cron varunbihani Linux - Newbie 5 07-08-2005 01:50 AM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 06:49 AM
how do i run shell script? krt47 Linux - Newbie 4 08-02-2004 09:29 AM
how to run a shell script oasisbhrnw99 Linux - Newbie 1 05-05-2004 01:21 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:38 AM.

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