Need some shell scripting help
OK, we all know how easily I get confused, so lets see if I can explain my
problem.
Usually, when I want to work with a list of files I do something like:
ls >aaa
while read item
do
echo "${item}"
done <aaa
rm aaa
The problem with this logic is that it requires a temporary file (aaa), so
I've been trying to figure out the syntax that doesn't need the file. What
I have so far, that sort of works is:
while read item
do
echo "${item}"
done <$(ls)
This works until the last item is echoed, at which point I get:
<item>: No such file or directory
or, if there are lots of files in the directory, I get:
<item>: File name too long
Even if the answer isn't, the question is simple: "How do I make this
work?"
TIA,
Dwarf
--
_-_-_-_-_- Author of "Dwarf's Guide to Debian GNU/Linux" _-_-_-_-_-_-
_- _-
_- aka Dale Scheetz Phone: 1 (850) 656-9769 _-
_- Flexible Software 11000 McCrackin Road _-
_- e-mail: dwarf@polaris.net Tallahassee, FL 32308 _-
_- _-
_-_-_-_-_- Released under the GNU Free Documentation License _-_-_-_-
available at: http://www.polaris.net/~dwarf/
Reply to: