Trying to run a function defined in my .bashrc using "bash -c ". I end up with the error "command not found". How do I get "bash -c" to load my init file?
Bash – How to load .bashrc from “bash -c”
bash
bash
Trying to run a function defined in my .bashrc using "bash -c ". I end up with the error "command not found". How do I get "bash -c" to load my init file?
Best Answer
You can make it into an interactive shell with
-i
, then your ~/.bashrc will be read:The other thing you can do is source the file explicit. If you have
/var/tmp/test
with content:and you do
you will get
123
echoed.