Failed to use alias command in bash script
Hi,
I'm writing a bash script using alias command. It's normal when I enable alias options with "shopt -s expand_aliases" and put all the code in one file. However, if the script is divided into 2, confusing situation happens.
Below is part of the code to demonstrate the problem. Please help. Thanks.
sub script(sub.sh):
subFunction(){
alias ll="ls -l"
alias -p <= normal here
ll <= command not found
}
main script(main.sh):
source sub.sh
shopt -s expand_aliases
subFunction
ll <= normal here
iMac, macOS High Sierra (10.13), null