newbie script question

David L Norris dave at webaugur.com
Sun Jan 25 18:07:07 UTC 2004


On Sun, 2004-01-25 at 12:29, Ko Pu wrote:
> linux (a text file) content:
> cd /mnt/w2k/download/Linux
> 
> I tried to use this command:
> [kpu at d209-121-129-174 kpu]$ . linux
> [kpu at d209-121-129-174 Linux]$ changed to Linux directory

This tells your shell to execute the contents of the script.

> [kpu at d209-121-129-174 kpu]$ sh linux
> [kpu at d209-121-129-174 kpu]$ nothing happend

This tells your shell to start a new shell, cd /mnt/w2k/download/Linux,
then exit, which returns you back to your previous shell which is still
in the kpu directory.  Add a pwd command before and after your cd to
illustrate what is happening.

> then I made linux executable and tried to run it by just typing the name:
> [kpu at d209-121-129-174 kpu]$ linux
> bash: linux: command not found

That would be:
./linux

. is not in your PATH and for generally good reasons.


> Is there a place that I need to place this file? Right now it's sitting in 
> my $HOME, the book that I read mentioned nothing about special location for 
> user defined command. Sorry for this dumb question, I'm new to this.

I think an alias would be more appropriate.  Also, look into the pushd
and popd commands.  They are infinitely more useful than cd.

alias linux="cd /mnt/w2k/download/Linux"

-- 
 David Norris
  http://www.webaugur.com/dave/
  ICQ - 412039
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20040125/ae1193c1/attachment-0001.sig>


More information about the fedora-list mailing list