I’m trying to modify a ksh script to print out the line that contains the phrase “/var/corefiles” . I’m fairly new to scripting, so this has me buggered. For example, if I have the following line in a file
/dev/x /dev/x2 /var/corefiles yes
And I use this for loop:
for $host in $(grep "var/corefiles" $VFSTAB_LOC); do
echo $i
done
It outputs:
/dev/x
/dev/x2
/var/corefiles
yes
I’m a little confused as to why it only prints out one chunk at a time. If anyone has any explanations/modifications they would be most appreciated!
Simply doing
grep "var/corefiles" $VFSTAB_LOC(without thefororecho) will do exactly what you say you’re wanting to do.