If is possible to strings shell commands together on a single line with semicolons, like this:
for f in `ls *`; do echo "$f"; done
However, unless there is some very good reason not
to, you might want to consider placing the shell commands in a file, and executing the file. If the commands I used above were intended to be executed by bash
, and the commands are in the file $HOME/src/bash/my_loop.bash
could be used to execute the commands.