Skip to content


General Tips

Double Dash (--)

  • tells shell to treat any future dashes like strings and not flags
    • npm test -- -u -t="ColorPicker"
    • the -u is a flag for the command and not npm

grep "--hello" data.txt
grep: unrecognized option '--hello'
grep -- --hello data.txt

Why git checkout -- file.txt

  • the -- is optional in this case
  • just a good habit, since branches usually have dashes

Command substitution

result=$(curl -X GET 'URL')


String substitution




  • TODO: what's the difference?


Looping over array

for var in "$@"
    echo "$var"

Last update: 2023-04-24