This will cause LIST to grow very large (even a couple of GB in a short time etc):
$ for i in *; do echo $i; cut -d ' ' -f1 $i ; done > LIST
For example, after 10 seconds:
$ wc -l LIST
132654955 LIST
$ ls -hl LIST
-rw-r--r-- 1 user users 2.3G Jan 22 21:35 LIST
I think that the reason is that LIST is added to the list of files
that should be processed and cut never finishes processing it. I
found 3 solutions for this problem:
exclude
LISTfrom being processed:for i in !(LIST); do echo $i; cut -d ' ' -f1 $i ; done > LISTuse another directory for
LIST:for i in *; do echo $i; cut -d ' ' -f1 $i ; done > /tmp/LISTexpand
*before running the loop withC-x *or whatever$ bind -p | grep glob-expand-wordshows
Is my reasoning correct and which way is the best here?