Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Shell script noobie question?


    I'm running mdk 9.0, Bash version 2.05b.0.

    I'm going through the "Linux Shell Scripting Tutorial v1.05r3 A Beginners Handbook"

    I would like to be able to execute the scripts that I make from any directory that I happen to be in.

    To have the ability to do this I have followed the directions in the tutorial yet I'm still unable to execute the script by script name from any directory.

    I've create one script so far by following this tutorial.

    Script name: "first"
    vi first:
    #My first Shell Script
    echo "Knowledge is Power"

    I then save this and do "chmod +x first"
    sh first...executes fine
    bash first...executes fine
    ./first.....executes fine

    Then I type:
    cd (to make sure I'm in my home directory)
    mkdir bin
    cp first ~/bin

    Then type.... first ..... and I get:
    bash: first: command not found

    If I do "echo $PATH" I get the following:

    This is the default path that was installed by linux ManDrake.

    The Tutorial just assumes that this should work, but it doesn't, and it doesn't offer any other tips as to why it doesn't or what I need to do to get this working.

    Any helps is appreciated.


  2. #2

    What they forgot to mention was that I needed to log out of X and the back in for the changes to take effect. I fogot about this myself.

    So executing "first" from the command line in any directory works now.

    But now this brings on another very curious question.

    And I hope that I can get an answer on this. I've asked before but never really got an explantion for it.

    After creating the "bin" directory in my home directory and then logging out and back in my $PATH has changed a bit dramactically. Why is this specifically happening?

    Path statement after making "bin" directory and before logging out =


    Path statement after creating "bin" directory and logging out and the back in =


    Why is /usr/bin and /home/jbanks/bin listed twice in my $PATH statement? My path statement was modified for me transparently. I thought the only way for me to alter my path statement was to edit some cofig files of which I didn't touch.

    Whats causing this to happen?

    Thanks bunches..

  3. #3
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    It's probably some automagic detection function that Mdk has cooked up. It can be located in several places. I don't have Mdk, so I can't check, but check these files:

  4. $spacer_open
  5. #4
    Just Joined!
    Join Date
    Sep 2003
    Quebec, Canada
    If ir remember correctly, the $PATH is set in /etc/profile for Mandrake (which I'm pretty sure Mdk stands for, correct me if I'm wrong).

  6. #5
    Thanks for the responses. I've switched from Mandrake (and yes MDK is the short abbrevation for is if you look at the kernel build with "uname -a" or any rpm's built specifically for Mandrake...)

    I've since switched distro's though. I'm now using Gentoo as my new Linux it..and blows Mandrake out of the water along with all the other RPM based distro's.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts