Hi all. I am trying to loop over each line of output from a command like
this:
#!/bin/sh
fstypes='ext2fs msdos ntfs'
for fs in $fstypes
do
lines=$( mount | grep $fs )
for line in $dirs
do
echo $line
done
done
I can't seem to get the behavior that I want. The inner loop is either
delimeting on spaces, or if I use quotes, it gets the whole thing.
In perl, this does what I want:
#!/usr/bin/perl -w
open( FH , "mount | grep ext2fs |" ) || die("can't open");
while( <FH> ){
print;
Is there any way to loop over each line of output like that in sh?Quote:}
Thanks in advance
-Adam