Re: newbie script question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@d209-121-129-174 kpu]$ . linux
> [kpu@d209-121-129-174 Linux]$ changed to Linux directory

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

> [kpu@d209-121-129-174 kpu]$ sh linux
> [kpu@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@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

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux