LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   1st script attempt; cygwin; fails "bash: myscript : command not found" (https://www.linuxquestions.org/questions/linux-newbie-8/1st-script-attempt%3B-cygwin%3B-fails-bash-myscript-command-not-found-767760/)

engineerd1 11-08-2009 03:15 PM

1st script attempt; cygwin; fails "bash: myscript : command not found"
 
Hello, this should be in the newbie^^2 forum, I know.... But I just downloaded cygwin to my xp machine.....Tried my first experimental script and created it one level directly below where cygwin put me by default. The script, named showtwo says....

#!/bin/bash
echo $1
echo $2

But bash apparently can't find it.....

The name of the script is showtwo, but I also tried naming it showtwo.sh; no dice.

AuroraZero 11-08-2009 03:28 PM

Quote:

Originally Posted by engineerd1 (Post 3749595)
Hello, this should be in the newbie^^2 forum, I know.... But I just downloaded cygwin to my xp machine.....Tried my first experimental script and created it one level directly below where cygwin put me by default. The script, named showtwo says....

#!/bin/bash
echo $1
echo $2

But bash apparently can't find it.....

The name of the script is showtwo, but I also tried naming it showtwo.sh; no dice.

I am a little confused here. Is this a Windows Xp machine or a Linux Box?

smeezekitty 11-08-2009 03:44 PM

Quote:

I am a little confused here. Is this a Windows Xp machine or a Linux Box?
its windows XP.
but what the OP does not understand is that you need to call programs in the local directory with ./

engineerd1 11-08-2009 03:44 PM

its an xp machine

engineerd1 11-08-2009 03:54 PM

right. I did not know (forgot since last used unix 25 years ago)that...

Furthermore, if I am a level above where the script is, I invoke by...

./oneleveldowndir/showtwo

and so on....

so the natural followup is... what do I do to make a script invokable without specifying the full pathname? Or please refer to appropriate tutorial so I don't waste more time here....

smeezekitty 11-08-2009 03:56 PM

you could put it in your path enviroment.

Tinkster 11-08-2009 03:56 PM

It's a (sane!) default for unix/linux shells not to have
the current working directory in the path. Either use the full
path, or a relative path to execute the script.

./script or /home/username/script



Cheers,
Tink

Tinkster 11-08-2009 03:58 PM

You could edit your ~/.bashrc and modify the PATH variable


export PATH=${PATH}:.


Don't do that for root, though, if you get to a real Unixy
kind of box. It's a security risk.

smeezekitty 11-08-2009 04:03 PM

Quote:

You could edit your ~/.bashrc and modify the PATH variable


export PATH=${PATH}:.
thanks for the tip! i will go do that in my linux box (as root of cource).


All times are GMT -5. The time now is 11:59 AM.