General
cancel
Showing results for 
Search instead for 
Did you mean: 

problem in running a shell script

SOLVED
Go to solution
Francis Ancheta
Frequent Advisor

problem in running a shell script

Hi,

One last question for the day. Why is it when ever I download a .tar.gz file then extract it, I have problems in running the shell script.

I have the following error:

[root@TSHDSFW yahoopops-0.4.5]# pwd
/home/downloads/Yahoopops/yahoopops-0.4.5
[root@TSHDSFW yahoopops-0.4.5]# ls
common docs README src ypcompile ypcompilelinux ypinstalllinux
[root@TSHDSFW yahoopops-0.4.5]# ypcompile
-bash: ypcompile: command not found
[root@TSHDSFW yahoopops-0.4.5]#


attached is the shell script
9 REPLIES
Caesar_3
Esteemed Contributor
Solution

Re: problem in running a shell script

Hello!

It's because your "." directory not in your
PATH, if you run it you can run by adding "./"
to the name : ./ypcompile

Caesar
Jerome Henry
Honored Contributor

Re: problem in running a shell script

Try
./ypcompile
You have to add ./ when script is not an internal command.

Good night !

J
You can lean only on what resists you...
Francis Ancheta
Frequent Advisor

Re: problem in running a shell script

Ceasar Thanks ... he he he ... I used to laugh at my students in Microsoft if they had problems like this ... Dose of my own medicine.

one thing I learned in Linux that Microsoft ignores.

"Little things matter in Linux even if its just a dot a slash or a capital letter"

Claudio Cilloni
Honored Contributor

Re: problem in running a shell script

you can add the '.' directory to the PATH variable so:

export PATH=$PATH:.

you can add this line in /etc/bashrc (to execute it for all the users, when they log in) or in
the file .bashrc in the home directories of the users that want it.

hello
Claudio

Balaji N
Honored Contributor

Re: problem in running a shell script

hi

that is because your current directory(.) is not in the path.

do an echo $PATH

and u will see that ur current directory is not there.

so do an ./ypcompile.

and dont try adding current directory to your path. it is considered a bad practice.

http://theory.uwinnipeg.ca/faqs/unixfaqs.html#2.13

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Balaji N
Honored Contributor

Re: problem in running a shell script

hmm.. this forum is brimming with activity. when i clicked on the reply button, there was no replies. and when i see my reply, there are 5 more replies and the OP has already re-posted.


way to go....
and me need to be more attentive to grab those bunnies. ha ha ha
-balaji (weekend is fun....)
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Jerome Henry
Honored Contributor

Re: problem in running a shell script

Same issue for me Balaji ! What do you plan for the w.e. ?

I 100% agree with the path issue, which is bad practice, and dangerous as for security reasons. That's why I didn't suggest it, but it's still possible and technically correct.
A good old ./ seems better anyway.
J
(celebrating longuest day of the year this w.e.).
You can lean only on what resists you...
Balaji N
Honored Contributor

Re: problem in running a shell script

oh! jerome! hmmm... we are hijacking this thread again.

me need to catch up with a few friends and party. nothing specific other than that.

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Claudio Cilloni
Honored Contributor

Re: problem in running a shell script

I never thought about it could be a security risk. And it isn't difficult to figure out why.
nevertheless this, I agree with you: it's a good idea specify explicitely that I want execute the command that resides in the current directory.

bye
Claudio