While trying watch bash -c 'du -h /etc/passwd && df -h' it appears that the path to file was completely ignored, and instead du -h ran through the current working directory. Same result was observed when I ran watch bash -c 'stat /etc/passwd && df -h', and stat returned with stat: missing operand error. By contrast, using watch -e "command /path/to/file" or watch "command /path/to/file" works without issues.
Why doesn't watch bash -c 'du -h /etc/passwd && df -h' work then ? Is it watch's issue or bash's issue with argument splitting ?
dubecomes$0and that's why it runs, however,dfis supposed to become of positional parameters tobashright ? or doessh -calready separate them when&&is encountered ? – Sergiy Kolodyazhnyy Oct 31 '17 at 02:24-hwill be $0. Yes, the&&separates them, this is just like runningbash -c du -h /etc/passwd && df -hdirectly in the shell (note lack of quotes). – muru Oct 31 '17 at 02:27