Aliases are not enabled by default in shell scripts. As mentioned, they can be enabled with
shopt, but even then that only makes it
possible to create them in the script. You won't get immediate access to all the aliases in the main shell. Since aliases can't be
exported, there's no way for a sub-process like a script to inherit a copy of them.
Aliases are rather pointless to use inside scripts anyway. Since you only need to write each command once, there's no real need for such user-interactive style shortcuts. It would also tend to make the code less obvious.
As mentioned, if you need to define code that will be used multiple times, or want to simplify longer commands, use
functions.
BTW, if you just want to shorten up a longer command that has regularly-defined option strings, you can store them in an array first.
Code:
options=( -x -n -a foobar --long-option=bazbum )
mycommand "${options[@]}" filename.txt
As for "
echo -n", I'd recommend using
printf instead, whenever you need anything fancier than the default
echo.