G
G
GSnick2015-03-02 15:37:55
linux
GSnick, 2015-03-02 15:37:55

How to embed a script in bash?

I apologize for a simple question, but I can’t find something at all. How can I call a script from bash without specifying the path to the script?
For example, there is a script in /home/user/script.exp
at the moment it can only be called through ./script.exp or /home/user/script.exp, but I would like to be able to call it from anywhere simply by user @server:~$ script

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
aardvarkx1, 2015-03-02
@GSnick

Either add /home/user/ to your PATH variable, or copy the script to one of the folders already in your PATH variable.

S
Saboteur, 2015-03-02
@saboteur_kiev

Usually, they do not put their scripts in the root of the home folder, but create a bin directory there (/home/[username]/bin), and various scripts are put there. and add this directory to PATH.

M
Meehalkoff, 2015-03-02
@Meehalkoff

# ln -s /home/user/script.exp /usr/bin/script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question