Unix & Linux Asked by young_souvlaki on September 14, 2020
~/.bashrc
----
example()
{
echo "example function"
}
If I use this in a shell script
#!/bin/sh
example
I get command not found.
I have tried
#!/bin/sh
source ~/.bashrc
example
but it doesn’t work.
I found these answers and think this question deserves to live here with a clear question and clear and concise answer.
Another thing to consider is that even if you run your program with #!/bin/bash
, it will not execute .bashrc, as it is a non interactive instance of bash
.
Answered by user429927 on September 14, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP