You are not logged in.

#1 2011-09-26 13:56:08

Dumbledore
Member
From: Mumbai, India
Registered: 2011-04-27
Posts: 56

[SOLVED] Where in path to keep my custom bash scripts

Hey Guys,

I apologize if this has been discussed before, I couldn't find another similar discussion in the forum.

Having followed from another discussion I had on arch before, I finally switched from being root to a regular user. However, there is this one little problem that I have now.

Earlier I used to stick my custom scripts in /usr/bin using symlinks. However, now, I clearly can not call these scripts from /usr/bin being a regular user. I have presently solved this problem by adding a "$HOME"/scripts folder to the path and calling my scripts from there. Everything has been tweaked to work again.

But I'd like to know if there is a robust solution to this problem. Where should one, say a sysadmin, keep custom scripts if he'd like users to be able to use them? And what should be safe permissions on these scripts?

Thanks for all suggestions.

Last edited by Dumbledore (2011-09-26 16:28:31)


GNU/Linux: Keep your options "open".

Offline

#2 2011-09-26 14:02:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Where in path to keep my custom bash scripts

Dumbledore wrote:

However, now, I clearly can not call these scripts from /usr/bin being a regular user.

If you still have your scripts in /usr/bin, post the output of

ls -l /usr/bin

as it shouldn't be a problem - users can use most of /usr/bin binaries w/o a problem and it has a bunch of symlinks by default.

Offline

#3 2011-09-26 14:15:06

Dumbledore
Member
From: Mumbai, India
Registered: 2011-04-27
Posts: 56

Re: [SOLVED] Where in path to keep my custom bash scripts

Umm.. Err.. I feel like a nitwit right now! I can swear that I had tested putting my scripts in /usr/bin earlier and calling the scripts had resulted in Permission Errors even though I had checked for _execute_ permissions then.

So I had removed those scripts from there. Now, since you asked for output, I tried putting a few scripts there again and funnily they are working now!!! Anyhoo, be that as it may, I'll check all of them and get back to this post if I find any other problem.

Meanwhile, I'm sure that Unix has a design philosophy which divides these directories with specific intentions. So, is /usr/bin a good place to keep one's custom scripts in principle?


GNU/Linux: Keep your options "open".

Offline

#4 2011-09-26 14:24:08

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Where in path to keep my custom bash scripts

/usr/bin should be maintained by the package manager. I keep a separate $HOME/bin in my PATH above all other bin's which contains my own scripts.

Offline

#5 2011-09-26 14:36:04

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] Where in path to keep my custom bash scripts

falconindy wrote:

/usr/bin should be maintained by the package manager. I keep a separate $HOME/bin in my PATH above all other bin's which contains my own scripts.

This.

Then there's /usr/local/bin

Offline

#6 2011-09-26 14:41:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Where in path to keep my custom bash scripts

falconindy wrote:

/usr/bin should be maintained by the package manager. I keep a separate $HOME/bin in my PATH above all other bin's which contains my own scripts.

Plus, it makes it easy to back your scripts up - just add a cronjob that rsyncs ~/bin to <somewhere_safe>. You can always reinstall the regular packages.

Offline

#7 2011-09-26 15:20:57

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] Where in path to keep my custom bash scripts

I started keeping local scripts in ~/.local/bin, compiled aur packages in ~/.local/var/cache/pacman/pkg, and various projects/git repos in ~/.local/src. I like the clean $HOME :-) If I had a multi user machine, any universally available  scripts would be symlinked into /usr/local/bin

Scott

Last edited by firecat53 (2011-09-26 15:23:29)

Offline

#8 2011-09-26 16:27:31

Dumbledore
Member
From: Mumbai, India
Registered: 2011-04-27
Posts: 56

Re: [SOLVED] Where in path to keep my custom bash scripts

Hmm.. thanks guys. Then it seems like I've been doing something right without even knowing it. big_smile

I've kept everything in "$HOME"/scripts and added it as first in my path. This is convenient because I'm the only using my laptop. Thanks for your replies. If I ever get to administering a multi user setup (quite unlikely, since I'm only a graduate student and don't let anyone touch my machine!) I'd remember /usr/local/bin.

Thanks! Marking as solved. smile


GNU/Linux: Keep your options "open".

Offline

Board footer

Powered by FluxBB