Ich verwende diese Art von Code: #!/usr/bin/env bash set -u exclude1='--exclude=/path/*' exclude2='--exclude=/path with spaces/*' exclude3='' # any 'exclude' can be empty tar -czf backup.tgz "$exclude1" "$exclude2" "$exclude3" 2>&1 | grep -i 'my_reg_exp' > error.log