Friday, October 31, 2014

Using Immediate documents (cat << EOF) to avoid shell quoting problems

If you want to add an entry to an alias file you normally have to jump through hoops to get the quoting properly, much easier with an immediate document since you can type the way would if editing the document itself:

cat <<EOF >> myaliases.bsh
alias go2usb='cd "/var/host/media/removable/USB Drive/"'
EOF

No comments:

Post a Comment