Answer the question
In order to leave comments, you need to log in
How to create your own team in Linux?
Is there any way I can create a command that will execute multiple commands in the terminal?
For example, to launch Android Studio, instead of
$ cd /opt/android-studio/bin/
$ ./studio.sh
$ android
Answer the question
In order to leave comments, you need to log in
To do this, create a permanent alias:
this command will write to the bash config file your permanent own alias to the required command (or several through the ";" sign). those. if you drive in "android" on behalf of your user, then in this case the automatic transition will be made to the desired directory and Android Studio will be launched. I think this is the easiest way :)
nano /usr/local/bin/android
Paste
#!/bin/bash there
cd /opt/android-studio/bin/
./studio.sh
Then exit and save. And chmod +x /usr/local/bin/android
All
Alias is just one way to solve your problem. In the broad sense of the word, the Linux shell (bash?) searches for the command that you typed in the console sequentially in all directories specified in the $PATH variable .
For example:
[email protected]:/home/user# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
PATH=$PATH:/opt/android-studio/bin/
export $PATH
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question