I have written some scripts and stored them in my ~/bin folder. I'm already able to run them just by calling their title during a shell session. However, they aren't running interactively (I mean, my ~/.bashrc aliases are not loaded).
Is there a way to mark them to run interactively by default? Or must I source ~/.bashrc inside of them to use any aliases defined there?
Other alternatives are welcome!
~/.bashrcby default? Because interactive shells come with some surprises, like ignoringSIGTERMbashrc's aliases in the scripts even when call them through bin referencealias hw='echo hello world'vshw() { echo hello world; }-iflag,bashrcfunctions are not loaded just like its aliasesshopt -s expand_aliases; . ~/.bashrcat the beginning of your script (~as in the non-accepted answer). You still have to modify a script to change its shebang, and as I already said, theinteractivemode comes with some changes in behaviour which are not desirable in a shell script. And, as @kojiro said, better use functions instead of aliases. Aliases only have advantages when used in an real interactive shell, I cannot think of any reason to use them in a script.