zephyr@lemmy.world to Programming@programming.dev · 1 year agoHow do you shell expand your variables and why?lemmy.worldimagemessage-square27fedilinkarrow-up166cross-posted to: shell@programming.dev
arrow-up166imageHow do you shell expand your variables and why?lemmy.worldzephyr@lemmy.world to Programming@programming.dev · 1 year agomessage-square27fedilinkcross-posted to: shell@programming.dev
minus-squareGamma@programming.devlinkfedilinkEnglisharrow-up5·edit-21 year agoTypically find "$HOME/docs", but with a few caveats: In Zsh or Fish, the quotes are unnecessary: find $HOME/docs If I’m using anything potentially destructive: mv "${HOME:?}/bin" ... Of course, if it’s followed by a valid identifier character, I’ll add braces: "${basename}_$num.txt"
Typically
find "$HOME/docs"
, but with a few caveats:In Zsh or Fish, the quotes are unnecessary:
find $HOME/docs
If I’m using anything potentially destructive:
mv "${HOME:?}/bin" ...
Of course, if it’s followed by a valid identifier character, I’ll add braces:
"${basename}_$num.txt"