LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-08-2009, 04:15 PM   #1
engineerd1
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
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.
 
Old 11-08-2009, 04:28 PM   #2
AuroraZero
Member
 
Registered: Oct 2009
Location: memphis, TN
Distribution: SlackWare 14.2, Android, Slax, Centos 5.9 Final, Centos 6
Posts: 188

Rep: Reputation: 32
Quote:
Originally Posted by engineerd1 View Post
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?
 
Old 11-08-2009, 04:44 PM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
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 ./
 
Old 11-08-2009, 04:44 PM   #4
engineerd1
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
its an xp machine
 
Old 11-08-2009, 04:54 PM   #5
engineerd1
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
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....
 
Old 11-08-2009, 04:56 PM   #6
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
you could put it in your path enviroment.
 
Old 11-08-2009, 04:56 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 11-08-2009, 04:58 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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.
 
Old 11-08-2009, 05:03 PM   #9
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
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).
 
  


Reply


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
build Cinelerra 2.1 for x86_64, bash "arch" command not found? newtovanilla Linux - Newbie 4 07-08-2008 06:28 PM
"bash: rpm: command not found" errom when trying to install any package sandeepchau123 Linux - General 16 07-06-2008 04:58 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
bash: passwd: command not found "HELP" balweg Red Hat 4 05-05-2005 04:47 PM
LFS 6.0 error: glibc fails check with "g++: command not found" peristaltic Linux From Scratch 1 03-15-2005 08:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:46 PM.

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