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
bashnano ~/.bashrc or ~/.zshrc
Add the following line at the end of the file:
bashexport PATH=$PATH:~/scripts
OR
echo 'export PATH=$PATH:~/scripts' >> ~/.bashrc
source ~/.bashrc
Save and close the file, then reload your .bashrc
:
bashsource ~/.bashrc
Comments
Post a Comment