Consider this tiny script:
# script.sh
echo $@
If I call it like this ./script.sh ~/docs, I get /home/me/docs as output. However, I need it to echo ~/docs. How can I achieve that?
Consider this tiny script:
# script.sh
echo $@
If I call it like this ./script.sh ~/docs, I get /home/me/docs as output. However, I need it to echo ~/docs. How can I achieve that?
It's not under the script's control. It's up to the user. They must quote the tilde to prevent it from being expanded. Options include: