Find the answer to your Linux question:
Results 1 to 4 of 4
I want to set paths via my own script (paths.sh): Code: export PATH=$PATH:/usr/bin/python2.5:~/www/bin export PYTHONPATH=$PYTHONPATH:/usr/bin/python2.5:~/www/site-packages echo -e "PATH-->$PATH \n PYTHONPATH--->$PYTHONPATH" mainly because I fo not have an access to my ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    2

    set $PATH via ./paths.sh


    I want to set paths via my own script (paths.sh):
    Code:
    export PATH=$PATH:/usr/bin/python2.5:~/www/bin
    
    export PYTHONPATH=$PYTHONPATH:/usr/bin/python2.5:~/www/site-packages
    
    echo -e "PATH-->$PATH \n PYTHONPATH--->$PYTHONPATH"
    mainly because I fo not have an access to my home folder, so no bash.rc

    my question is why after running the script ./paths.sh
    there is no effect!!

    if I execute the commands manually one by one, it is all OK.

    maybe I'm missing something in the script?

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    source your file, instead of running it, e.g.:
    Code:
    . paths.sh

  3. #3
    Just Joined!
    Join Date
    Oct 2009
    Posts
    2
    hmm it works!
    so whats the difference?

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    When you run it (./paths.sh), you are doing everything in a new shell (which then exist when the script completes). When you source it (. paths.sh), you are doing everything in your current shell. This is how profiles scripts work (/etc/bashrc, ~/.bashrc, etc.), they are sourced at login time.

Posting Permissions

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