Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 500  / 1 Year ago, sat, april 29, 2023, 10:56:09

How do I make a new command to run a script, for example if I type runme (from any dir) it will run /run/me/script.sh?
Seems simple but I can find anywhere that explains how to do this :/


More From » 11.10

 Answers
6

simply add /run/me to your PATH, any script put there could be simply run from any directory



how to PATH from troubleshooters.com

To add directory /data/myscripts to the beginning of the $PATH environment variable, use the following:



PATH=/data/myscripts:$PATH


To add that directory to the end of the path, use the following command:



PATH=$PATH:/data/myscripts


finally



export PATH


to have it everywhere, all the times, for your user only, add these in place the lines in that user's .bash_profile file

all users except root: add to /etc/profile

for root: only possible by root's .bash_profile





my idea for the sake of laziness (not your case of running 'every' script though): add a symbolic link from a single script there to your /home/usr/loca/bin


[#39683] Monday, May 1, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
earxcept

Total Points: 310
Total Questions: 115
Total Answers: 111

Location: Japan
Member since Sat, Oct 2, 2021
3 Years ago
;