Results 1 to 10 of 10

Thread: Export PATH

Hybrid View

  1. #1

    Export PATH

    I have been piddling around, trying to learn some shell scripting, so I decided to create a directory in my home directory to store all of my test scripts. I tried to add that directory to my $PATH with:

    export PATH=$PATH:/path/to/my/directory

    However, when I log out, and log back in, bash doesn't save this change. It acts like the change is only good for the current session. Did I do this wrong, or is this related to my not having a ".bash_profile" file?
    Asus A8V Deluxe Mobo
    AMD Athlon64 X2 4400 -939
    2GB Crucial DDR3200 Dual-Channel
    ATi AiW 9800 Pro 128DDR
    Audigy2 ZS
    Sony DRU-810 DVD+RW DL
    3 x Maxtor MaxLine SATA 160Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 300Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 120Gb 16Mb Cache

  2. #2

    Re: Export PATH

    vwgtiturbo,

    Your current method only changes the PATH for the current session. Once you log out, anything you've added to the path will be removed.

    The way to modify the path variable permanently is to edit .bash_profile (assuming you are using the default bash shell).

    To edit the .bash_profile, change to your home directory (IE: /home/username) and type: vi .bash_profile then arrow down until you find the line that looks similar to this:

    PATH=$PATH:$HOME/bin

    Type i to enter 'insert' mode, then add whatever directory you want to the end of it (remember to use the ':' between directory names). Press the escape key to exit 'insert' mode, type :w to write the file and type :q to quit the vi editor.
    AMD Athlon 2200+ 1.8Ghz
    1280MB PC-3200 CAS2.5 RAM
    ATI Radeon 9600 Pro 128MB AGP
    Western Digital WDC WD2500JB-00FUA0 250GB 7200 rpm ATA/133
    Seagate ST3200822A 200GB 7200 rpm ATA/133
    Western Digital WDC WD1200BB-00CAA1 120GB 7200 rpm ATA/133
    Western Digital WDC WD800BB-00CAA1 80GB 7200 rpm ATA/133
    Maxtor OneTouch 2HA43R32 1TB 7200 rpm USB 2.0
    D-Link DFE-530TX+ 10/100 NIC
    D-Link DWL-G520 Rev.A
    Debian 5.0r1 Lenny

  3. #3

    Re: Export PATH

    The only thing I have in my /HOME directory is a .bash_history. I tried to create a .bashrc and .bash_profile manually but it didn't work, as far as recognizing my aliases. Is there something else I need to put in the file besides the aliases themselves? Do I need to tell bash to read the .bashrc file every time a terminal is opened up, or is it supposed to do that on it's own?
    Asus A8V Deluxe Mobo
    AMD Athlon64 X2 4400 -939
    2GB Crucial DDR3200 Dual-Channel
    ATi AiW 9800 Pro 128DDR
    Audigy2 ZS
    Sony DRU-810 DVD+RW DL
    3 x Maxtor MaxLine SATA 160Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 300Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 120Gb 16Mb Cache

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Re: Export PATH

    Did you use vi to try to create a .bash_profile as SkyNet suggested?

    The .bashrc and .bash_profile files are read at login automatically by bash. If you are using a different shell (such as ksh or csh) they won't help, but if you have a .bash_history you are using bash so these are the files you need.

    You said you tried to make the .bash_profile and .bashrc manually but it didn't work as far as recognizing your aliases? I'm not sure what you mean by this, but are you trying to say you have to set your aliases every time you login now but the other problem is fixed? If that's the case you need to add your aliases to the .bashrc file.

    If that's not what you meant, sorry... I wasn't sure what you meant and that was the only thing that made sense to me

    Good luck.

  5. #5

    Re: Export PATH

    Well, I tried to create a .bashrc file and only put the aliases in it, as shown below:

    alias la='ls -al'
    alias ll='ls -l'
    alias lal='ls -al'
    alias go='exit'
    alias cle='clear'

    Those five lines were the only thing in the .bashrc that I created. My problem is that I don't know if I need to do something else to this file to make it work, or if I need to somehow change another file to tell bash to read this... I am just not sure if these lines are all I need to make bash use these aliases every time I start a terminal (or start up in runlevel 3).
    Asus A8V Deluxe Mobo
    AMD Athlon64 X2 4400 -939
    2GB Crucial DDR3200 Dual-Channel
    ATi AiW 9800 Pro 128DDR
    Audigy2 ZS
    Sony DRU-810 DVD+RW DL
    3 x Maxtor MaxLine SATA 160Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 300Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 120Gb 16Mb Cache

  6. #6

    Re: Export PATH

    Is it possible that right now, I am just using a systemwide .bash_profile and .bashrc?
    Asus A8V Deluxe Mobo
    AMD Athlon64 X2 4400 -939
    2GB Crucial DDR3200 Dual-Channel
    ATi AiW 9800 Pro 128DDR
    Audigy2 ZS
    Sony DRU-810 DVD+RW DL
    3 x Maxtor MaxLine SATA 160Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 300Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 120Gb 16Mb Cache

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Re: Export PATH

    If you have a .bashrc and .bash_profile in your homedir it will override any settings in the global .bash_profile and .bashrc.

    Did you log out and back in to test that the new .bashrc and .bash_profile worked? They won't take effect for the session you created them in, because they didn't exist when you logged in with that session. Try logging out and back in now that you have them and see if they worked.

  8. #8

    Re: Export PATH

    Yep, I just tried it, and I still have a no-go. I will look at some bash references I found and hopefully they will help out. Thanks for the help!
    Asus A8V Deluxe Mobo
    AMD Athlon64 X2 4400 -939
    2GB Crucial DDR3200 Dual-Channel
    ATi AiW 9800 Pro 128DDR
    Audigy2 ZS
    Sony DRU-810 DVD+RW DL
    3 x Maxtor MaxLine SATA 160Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 300Gb 16Mb Cache
    1 x Maxtor MaxLine SATA 120Gb 16Mb Cache

  9. #9

    Re: Export PATH

    I don't know if this is the case, but you might need to put that export command infront of the PATH=yadda yadda. Then relogin, and see if that solves the problem.
    AMD Athlon 2200+ 1.8Ghz
    1280MB PC-3200 CAS2.5 RAM
    ATI Radeon 9600 Pro 128MB AGP
    Western Digital WDC WD2500JB-00FUA0 250GB 7200 rpm ATA/133
    Seagate ST3200822A 200GB 7200 rpm ATA/133
    Western Digital WDC WD1200BB-00CAA1 120GB 7200 rpm ATA/133
    Western Digital WDC WD800BB-00CAA1 80GB 7200 rpm ATA/133
    Maxtor OneTouch 2HA43R32 1TB 7200 rpm USB 2.0
    D-Link DFE-530TX+ 10/100 NIC
    D-Link DWL-G520 Rev.A
    Debian 5.0r1 Lenny

  10. #10
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Re: Export PATH

    Yes, the .bash_profile should have a line as such:

    export PATH=$PATH:/path/to/other/dir/

    but the aliases should be just like setting aliases on the command line:
    alias myalias="echo 'myalias'"

    for instance

Similar Threads

  1. Export/paste OneNote outline to Excel?
    By Matt Peterson in forum Windows - General Topics
    Replies: 0
    Last Post: 01-24-2006, 06:40 PM
  2. export to a text file with comma & quote delimiter
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-04-2005, 01:33 AM
  3. Export a Playlist in Windows Media Player
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-03-2005, 11:18 PM
  4. import and export information in OneNote 2003
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-01-2005, 03:47 AM
  5. What to import/export via nfs?
    By ph34r in forum Linux - General Topics
    Replies: 3
    Last Post: 11-17-2002, 04:10 PM

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
  •