0

I'm trying to redirect shell output to both console and file I have tried below

#!/bin/sh
exec &> >(tee -a log.log)
echo "testing"

And running the shell script in terminal like ./filename.sh but getting error "syntax error near unexpected token `>'", I'm using iTerm terminal in Macbook

Finally I want to run the whole script in AWS data pipeline.

Léa Gris
  • 17,497
  • 4
  • 32
  • 41
Dev
  • 413
  • 10
  • 27
  • 3
    Both `&>` and `>(..)` are bash specific constructs. Your shebang interpreter is set to run with `sh` shell which might not support those options – Inian Sep 03 '20 at 15:02
  • ...and if you _intend_ to write scripts to be run with `sh` instead of `bash`, use the `sh` StackOverflow tag instead of the `bash` one. – Charles Duffy Sep 03 '20 at 16:10

0 Answers0