Reputation: 23
I'd like to understand why sourcing a script in csh
works but doesn't in bash
. I have files for both csh
and bash
that set an alias
for jr
command.
\bsource
for bash and \csource
for csh
I have two scripts:
source \csource
jr something
and this works like a charm, but:
source \bsource
jr something
gives me
jr:command not found
Could someone please shine some light on it as I've searched far and wide to no avail.
Kind regards
BoB
Upvotes: 2
Views: 4959
Reputation: 21492
In Bash, aliases are not expanded when the shell is not interactive, unless expand_aliases
option is enabled explicitly. Therefore, you should enable this option before sourcing a file with aliases:
shopt -s expand_aliases
source bsource
jr
Upvotes: 1