New answers tagged loop-device
Yes, unless you have a very recent kernel there is significant overhead when using loop devices on linux: data accessed through the loop device has to go through two filesystem layers, each doing its own caching so data ends up cached twice, wasting much memory (the infamous "double cache" issue) Aside from casual use better alternatives would be to use a ...
If you know prior to the loop how many repetitions you are going to need, such as iterating a countable number of static files to process, you should use a for loop. That is what for loops are good at doing. If you are unsure, and the loop may be different based on what happens during processing, such as some sort of iterative aggregation algorithm that ...
for i in Alpha Beta Charlie; do echo "$i" done You don't need eval and you don't need ls. Alternatively, you could just print each of these directly, with a newline character after each: printf '%s\n' Alpha Beta Charlie Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when ...
That should be as simple as: for i in A B C; do echo "$i" done
for i in "echo 'strat'" "ls -l " "echo 'print 2'" "echo 'print 3'" do eval $i done or generic for i in expr1 expr2 expr3 ...expr n do eval $i done
Top 50 recent answers are included