Because it's cumbersome to run a tool written in a shell script by specifying the path one by one, I want to be able to execute it only with the file name (ie I want to pass the path)
For example, if you develop with golang,go get
orgo install
will install it in the specified location ($GOPATH). There is no such mechanism.
There are various realization methods, but I asked which method I thought was better. Thank you
How you thought- Pass a new path to the directory used for tool development (this is unlikely)
- Place the script file directly in the pathed directory (for example,
/usr/local/bin/
) - Create a symbolic link from the directory used for tool development to the directory where the path has passed
- Create a directory for the shell script and pass the new path
- Create a directory in which to place the shell script, and create a symbolic link from there to the directory that passed the path
-
Answer # 1
-
Answer # 2
I think it depends on how the tool is used, but if you only use it (such as a laptop) or if you use it on some server,/usr/I think I should put it in local/bin. Most OS should be through the path.
If you don't want anything on the server, you can get it directly from Git with Curl and pipe it, but this is not always the script on the server (if you have a lot of servers) It is effective sometimes, but otherwise it is subtle.
Related articles
- linux - shell script duplicate replacement method
- linux - shell script if statement doesn't work
- shell script - questions about linux terminal commands
- i want to resolve shell script error "unexpected end of file" on linux
- linux - [shell script] convert only lf of a file in which crlf and lf are mixed
- linux - when you want to continue after the job of the shell script qsub is finished
- how to reference variables in linux shell script
- linux - array is garbled in shell script
- Shell script to automatically install python3
- linux - i want to rename and save the previous day's log file with a shell script
- linux - area calculation using shell script
- linux shell script creation
- shell script linux
- linux - [shell script] replacing the date and time information described in csv
- java - i want to install openjdk on red hat enterprise linux
- cannot execute shell script at specified time with cron
- i want to change the date format in a shell script
- Shell script to realize guessing game
- how to delete oldest file in shell script
- Shell script to realize number guessing game
- linux - cannot use kubectl command
- linux - [awk] ① i want to store $0 in a variable ② i can't output with echo instead of print
- linux - about "" and ""
- linux - i don't know how to edit profile with a text editor and save environment variables (learning about bash)
- linux - i want to generate json from a list
- i want to call the argument of the python script executed on the terminal in the code and omit it
- linux - how to align multiple outputs horizontally and output to csv
- linux - about errors when running npm run dev
- linux - i want to pass here document to variable
- linux - command to count the number of files in the folder two below
There is no "best" of this kind.
If it is general-purpose that is not project-specific, it is usually placed in
~/bin/
.At least for CentOS, set the default
~/.bash_profile
toThere is.