I feel like this should be simple but quoting and the like always confuse me in bash.. I am trying to run a command over an ssh connection and I want to use timeout
with that command. All well and good for simple commands, but now I want to run something like this (just a mock):
while read id; do
find . -name $id -exec echo '{}' \;
find . -name ${id}-other -exec echo '{}' \;
done < <(grep foo foo.txt | awk '{print $1}')
so I try this:
timeout 60 while read id; do find . -name $id -exec echo '{}' \;; find . -name ${id}-other -exec echo '{}' \;; done < <(grep foo foo.txt | awk '{print $1}')
which of course doesn't work. So I try to wrap it in a bash -c
, but I really can't figure out how to properly escape it...
Any help would be appreciated.. I know this might be a duplicate of something, but I have actually looked around and I can't quite fit the examples I've found to my case here.