Results 1 to 4 of 4

Thread: sourcing a script file

  1. #1
    Join Date
    Oct 2007
    Location
    Todd Mission Texas
    Beans
    427
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    sourcing a script file

    In gnome Ubuntu 12.04 & before, I was told that if I wanted to source a script I could put it in a folder, '/home/dave/bin'.

    Since I upgraded to 14.04, I do not find this options.
    1. Has this option been depricated?
    2. Can I create this folder and what do I export to environment?

    Thanks for any light you can shed on this subject.
    Dave
    "Let us run the risk of wearing out rather than rusting out." __Theodore Roosevelt

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: sourcing a script file

    So - you were lied to previously. Sorry.

    "sourcing" and "running" a script are different. You can place a script into any directory inside your PATH (echo $PATH). It is extremely common to have a personal ~/bin/ directory and adding that to your PATH so they are available. Of course, the file will need read + execute permissions set as you like - probably just the owner, if it is you, but perhaps the group and others as well. Scripts must be readable to be run.

    To learn more: http://linuxcommand.org/tlcl.php - just skim the first 100 pgs. It should clear up some misconceptions that may have been assumed.

  3. #3
    Join Date
    Apr 2012
    Beans
    7,256

    Re: sourcing a script file

    The default ~/.profile file (copied from /etc/skel when you create a user account using adduser) should have a section in it like

    Code:
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
    fi
    This means that all you need to do is create a ~/bin directory and it will automatically be added to your PATH next time you login.

  4. #4
    Join Date
    Oct 2007
    Location
    Todd Mission Texas
    Beans
    427
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: sourcing a script file

    Quote Originally Posted by steeldriver View Post
    The default ~/.profile file (copied from /etc/skel when you create a user account using adduser) should have a section in it like
    Worked perfectly... Thankss
    "Let us run the risk of wearing out rather than rusting out." __Theodore Roosevelt

Bookmarks

Posting Permissions

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