How to run bash script from anywhere in terminal in kali #kalilinux #commands





 

4. Add the Scripts Directory to Your PATH

run the script from the anywhere in the terminal

To easily run your scripts from any location in the terminal, add the scripts directory to your PATH. Open your .bashrc file:


Important make sure that u check your terminal shell name.

After that change this

1.shebang from file

#!/bin/bash #!/bin/zsh and vice versa

bash
nano ~/.bashrc or ~/.zshrc

Add the following line at the end of the file:

bash
export PATH=$PATH:~/scripts

OR

echo 'export PATH=$PATH:~/scripts' >> ~/.bashrc source ~/.bashrc

Save and close the file, then reload your .bashrc:

bash
source ~/.bashrc

Comments

Popular posts from this blog

How To Customize Linux Bootloaders ... #customization #linuxcustomization #kalilinuxcustomization

Linux Commands part - 2 #kali