By specified terminator ( ; ) like in C/C++ programming, you can run multiple commands consequently. We usually want to do this when we want to compile and install source code for certain packages.
Bash first execute the configure, then make , consequently will install the package. But bare in mind, bash have no intelligent, if error at configure, the consequent command will still run.
By using terminator, you can make loop into a single line command too. The example shows how to use while loop, read to read directory from a command line and show the directory’s cumulated size.
while read line; do du -sh $line; done <<< `ls -d */ `
Let me explain a bit, I looks like an interesting combo of command.
ls -d */ list only the directories, this feed to read. read is to read any input, for this case it read from the output of ls -d */. It uses <<< to pass its output to read.
line is just a variable to store the output of ls -d */ one by one. $line contain the string of line it store. Observered the do, it does du -sh the "output" one by one.
Actually, this is not a good example. What it does is very redundant, by doing this
du -sh */
you can get the same job done.
If you have a better example to share, please feel no hesitate to comment it.