I am trying to create a script to be reload bashrc once but it did not work.
reloader.sh
#!bin/bash
source ~/.bashrc
rm reloader.sh
I am trying to create a script to be reload bashrc once but it did not work.
#!bin/bash
source ~/.bashrc
rm reloader.sh
I had the same problem. The issue is that only interactive shells can access whatever you have defined in your .bashrc
(Aliases and so on)
To make your shell-script interactive use a shebang with parameter:
#!/bin/bash -i
You need to use source
to run the script:
source reloader.sh
If you just run it as a command, it will run in a new process, so none of the changes that .bashrc
makes will affect your original shell process.