Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 06 Dec 2019, 04:08
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
How to set PATH variable so that it persists across boots?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
rsfairman

Joined: 11 Jan 2017
Posts: 8

PostPosted: Wed 11 Jan 2017, 13:22    Post subject:  How to set PATH variable so that it persists across boots?  

So, how is this done? I would like PATH to start with '.' (the current directory) so that executables or scripts that I create can be launched more easily from the command-line. I'm aware of the risks of doing this, but it's easier for me.

I am running tahrpup 6.0.5 on an old Dell laptop (Latitude D520), and it's a fresh "full" install on the hard drive.

I tried adding

PATH=.:$PATH

in several places. The most natural seems to be /root/.profile, but it doesn't work. I also tried /etc/profile, but that won't do it either. I also tried it with and without an 'export'. It does change PATH if I type 'source .profile', but I would rather it happen automatically when I reboot.

Thanks,
Randall
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14520
Location: Gatineau (Qc), Canada

PostPosted: Wed 11 Jan 2017, 15:20    Post subject:  

Hello, rsfairman.

I see that this is your first post on this forum, so... "Welcome aboard!" Very Happy

I hope that Puppy Linux will suit your needs and that your Puppy
experience will be enjoyable!

About your question:

It is generally not a good idea to include . (current directory) in your path,
because 1) the executables present in the current directory may override
the system-defined executables, and; 2) it exposes your system
needlessly to possible outside intervention.

Please see:
http://unix.stackexchange.com/questions/65700/is-it-safe-to-add-to-my-path-how-come
about this.

That said, if you still wish to include it, it is recommended to place this
directory at the end of your current path, like so:
Code:
export PATH=$PATH:.
to maintain the priority of the system executables and potentially save
you a few headaches in case the local executable would conflict with a
system executable.

To make this change permanent in your Puppy, may I suggest that you
do the following:
-- open a terminal
-- issue command
Code:
echo "export PATH=$PATH:." >> /etc/profile.local

If you do not already have a < profile.local > file in /etc, it will be created.
If you do, the < export > line above will simply be added at the end of it.

We put this change in the user's local profile because we try to avoid
messing up anything in the main system profile. In Puppy, the main
system profile calls the user's (i.e. local) profile anyway when it has
finished its job, so there's no difference in performance.

Also, in Puppy, we have the already existing solution of putting one's
personal executables in /root/my-applications/bin and the corresponding
needed libraries (when applicable) in /root/my-applications/lib. Those two
directories are already in Puppy's default system path (on lines 2 and 3 of
the /etc/profile file).

Finally, as you may already know, in Linux generally, we have the ready-
made solution of calling an executable located in the directory where we
are presently from a terminal by typing
Code:
./executable

Any feedback welcome.

IHTH (I Hope This Helps).

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1937
Location: Japan

PostPosted: Thu 12 Jan 2017, 05:56    Post subject: Re: Setting PATH variable
Subject description: How to modify PATH variable so that it persists across boots
 

rsfairman wrote:
I also tried /etc/profile, but that won't do it either
Why not? What exactly did you try? It worked for me when I tried . Changed PATH to
Code:
PATH=".:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin"
then restarted X (no reboot).
Back to top
View user's profile Send private message 
rsfairman

Joined: 11 Jan 2017
Posts: 8

PostPosted: Thu 12 Jan 2017, 17:27    Post subject: Setting PATH variable  

Thank you both for the very complete answers.

Mochi, you are right, that editing /etc/profile does work. After trying too many things I got mixed up.

Although adding to /etc/profile.local does work, I was hoping to avoid messing with things in /etc. As musher0 says, it's good to avoid "messing up anything in the main system profile." An extension of that sentiment is the desire not to go into /etc at all if you can avoid it. That's why it seems better to put anything specific to my install in /root or some other space segregated from the standard installation.

Then again, it works, so no complaints!

Thanks,
Randall
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0620s ][ Queries: 12 (0.0103s) ][ GZIP on ]