What I'd like to do is send a single file "repeatedly" (like cat'ing it an infinite number of times) as input to another program. Is there a way on the command line/using bash?
The following syntax is used for create infinite while loop in a shell script. echo "Press [CTRL+C] to exit this loop..." You can also Unix true command with while loop to run it endlessly. The while loop syntax with true command will look like below example.
An infinite loop in Bash or any other programming language refers to a loop that is continuous i.e., its terminating condition is never met or its executing condition forever stays true. Such loops in any programming language are very simple to write.
Basic structure of the for loop The basic syntax of a for loop is: for <variable name> in <a list of items>;do <some command> $<variable name>;done; The variable name will be the variable you specify in the do section and will contain the item in the loop that you're on.
The yes
command, using the file's contents as it's argument:
yes "$(<file)" | somecommand
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With