I have this:

npm install "$tgz_path"  &>> "$HOME/.r2g/logs/r2g.log";

but that is syntactically incorrect. How do I append stdout+stderr to that log file?


That syntax is valid in bash. From man bash:

The format for appending standard output and standard error is:


A more basic way to write it (that works in more shells) will be:

$ npm install "$tgz_path" >>word 2>&1 "$HOME/.r2g/logs/r2g.log";
| improve this answer | |
  • yeah maybe bash3 can't do the first one, I get a syntax error with bash3 – Alexander Mills May 8 '18 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.