I know that contents of double quotes are expanded, whereas the contents of single quotes are not, such that
<the argument - blank in this particular example>
the same as
However, the question Bash: How to create an alias in .bashrc for awk with parameters led me to wonder why double quotes and not single quotes were used when declaring the alias, thus:
I would have employed single quotes as in the latter example. Most examples on the web use single too, unless there is some expansion required. However, in this case, no expansion, to my eyes, is apparent. Is it that, in this case, they are interchangeable, or are the double quotes necessary because a function definition is employed?
echo "~"will not be expanded if quoted either way. In double quotes you will get the
$-expression expanded. In cases where no expansion is effective but you want no splitting to occur, like in
echo "hello world"either quotes are appropriate. In some cases no quotes are necessary (even if often seen), e.g. in assignments like