I have this:
timeout 25 bash -c '
for i in {1..9}; do
if read line < "$my_fifo"; then
if test "$line" != "0"; then
exit 0;
fi
fi
done
'
I don't really like that bash can't do this:
timeout 25 (...)
I don't understand why () is not considered a program by itself. Just an anonymous program... anyway..
my goals is to achieve the above but without the need to use bash -c 'xyz'
since I won't get syntax highlighting in the quotes etc.
Is there a workaround for this?
bash can't do this
I don't think it has anything to do with bash or whatever shell you use. Rather it's because the program (timeout
), which is not a shell, expects/executes another program. A program here refers to an executable, and(...)
is a part of the shell script itself. Bash can't make it an executable fortimeout
to "chainload" it.read
builtin supports a-t
option as well.