Announcement

Collapse
No announcement yet.

Shell Scripts

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Shell Scripts

    OK, I was going through this tutorial, and I hit several bumps:
    http://www.linuxcommand.org/wss0010.php

    I set the command
    echo PATH=$PATH:/home/bin
    both from the terminal and in my .bash_profile
    But when I type
    my_script
    I get "command not found"

    /home/bin DOES show up when I do echo=$PATH. What gives?
    By the way, my_script is set to 755, and runs just fine when I type ./my_script

    #2
    Re: Shell Scripts

    In ~/.bashrc add export PATH=$PATH:/home/bin or whatever the correct path for the directory is where i put /home/bin. Put this at the bottom. Then you must close the current shell session and open a new one. I think that should work.

    Goodluck

    Comment


      #3
      Re: Shell Scripts

      Shouldn't you create the script in /home/<USERNAME>/bin rather than /home/bin?

      .bash_profile already contains this to add a user 'bin' to path if existing:
      Code:
      # set PATH so it includes user's private bin if it exists
      if [ -d ~/bin ] ; then
        PATH=~/bin:"${PATH}"
      fi
      If you want to create scripts for all users, the logical place for them are /usr/local/bin and /usr/local/sbin (which are already in PATH)

      Comment


        #4
        Re: Shell Scripts

        Originally posted by kubicle
        Shouldn't you create the script in /home/<USERNAME>/bin rather than /home/bin?
        Yes, sorry. That's what I meant. It is in /home/[MYUSERNAME]/bin

        EDIT: OK, I got it. Thanks! It works now.

        Comment

        Working...
        X