You are not logged in.

#1 2017-06-06 18:12:48

giuscri
Member
From: Milan, Italy
Registered: 2013-08-19
Posts: 21

In which directory should I put a bash script?

I've created a PKGBUILD for this tool, that's a bash script expected to be source'd in your .bashrc. Now, in the PKGBUILD I've pushed to the AUR I install that script to /etc/bash-preexec/bash-preexec.sh though I'm afraid that's non-standard. I wanted to hear where it's advised to put those kind of scripts and what would you have done.

Last edited by giuscri (2017-06-06 18:19:00)

Offline

#2 2017-06-06 20:31:31

helix
Member
Registered: 2013-02-17
Posts: 180

Re: In which directory should I put a bash script?

/usr/bin

As all executables...

Offline

#3 2017-06-06 21:09:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: In which directory should I put a bash script?

No, not /usr/bin as these are not meant to be executed - they are meant to be sourced.  I think /etc/profile.d/ could be an option. (edit: maybe not).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2017-06-06 22:03:49

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: In which directory should I put a bash script?

I guess it's a holy war between /etc and /usr/share. The longer I think about it I'm more inclined to /usr/share as those are usually read only files, as is the script. /etc contains dynamic configuration files. Though I wouldn't be surprised by either choice.

Offline

#5 2017-06-06 23:19:39

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: In which directory should I put a bash script?

Trilby wrote:

No, not /usr/bin as these are not meant to be executed - they are meant to be sourced.  I think /etc/profile.d/ could be an option. (edit: maybe not).

If the file is meant to be sourced by all users on the system then /etc/profile.d may well be the right place, but I would not want to use that system wink

/usr/share/<app>/wherever is probably the best place (that's where makepkg keeps its Bash sourceables). /etc/ is mostly for config files.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#6 2017-06-06 23:33:50

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: In which directory should I put a bash script?

I would concur with the /usr/share/<app> suggestion.

Offline

Board footer

Powered by FluxBB