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! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-08-2009, 04:15 PM
|
#1
|
LQ Newbie
Registered: Nov 2009
Posts: 3
Rep:
|
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.
|
|
|
11-08-2009, 04:28 PM
|
#2
|
Member
Registered: Oct 2009
Location: memphis, TN
Distribution: SlackWare 14.2, Android, Slax, Centos 5.9 Final, Centos 6
Posts: 188
Rep:
|
Quote:
Originally Posted by engineerd1
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?
|
|
|
11-08-2009, 04:44 PM
|
#3
|
Senior Member
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
|
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 ./
|
|
|
11-08-2009, 04:44 PM
|
#4
|
LQ Newbie
Registered: Nov 2009
Posts: 3
Original Poster
Rep:
|
its an xp machine
|
|
|
11-08-2009, 04:54 PM
|
#5
|
LQ Newbie
Registered: Nov 2009
Posts: 3
Original Poster
Rep:
|
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....
|
|
|
11-08-2009, 04:56 PM
|
#6
|
Senior Member
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
|
you could put it in your path enviroment.
|
|
|
11-08-2009, 04:56 PM
|
#7
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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
|
|
|
11-08-2009, 04:58 PM
|
#8
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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.
|
|
|
11-08-2009, 05:03 PM
|
#9
|
Senior Member
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
|
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 05:46 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|