where to add your personal bash script files [ SOLVED ]

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
ckonn
Level 3
Level 3
Posts: 180
Joined: Wed Oct 01, 2014 7:03 pm

where to add your personal bash script files [ SOLVED ]

Post by ckonn »

Hello,

as we know the bash shell executes a files only if they are stored in one of the directories included in the bash PATH. in many bash tutorials it is sad that the user must create a new "bin" subdirectory in his home directory, where he will add his new bash scripts.

what will happen if the user stores his personal bash scripts in the /usr/local/sbin directory? is there some kind of danger for the os or for some parts of it, if I do so?

thanks in advance
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
deepakdeshp
Level 20
Level 20
Posts: 12341
Joined: Sun Aug 09, 2015 10:00 am

Re: where to add your personal bash script files

Post by deepakdeshp »

The path to search can be found as follows:-
In my case it is as follows.

Code: Select all

echo $PATH
/home/uma/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
As a convention it is best to put in bin folder under home directory. You can choose /usr/local/sbin too.
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
Locked

Return to “Scripts & Bash”