Okay so I am very confused as to how to do this it says it is an exercise in my book but never talks about it or explains it please help I have tried everything every combination i can think of.
find out which of these filename paths exist using the ls command and save the list to a file in the pwd name 'existentFiles'
with parameters that aside from the file name args, only the -1 flag for the ls command should be used.
I have no clue what the command would be I have tried
ls -1 /etc/magic /sbin/fsck /boot/grub/menu.lst /usr/share/games/wombat /var/cache/man/index.db /usr/bin/defcon > existentFiles
and many variations but nothing........
then the 2nd part is to find out from the same list which pats exist and which dont using the same parameters except adding both a list in the pwd named existentFiles and a list in the pwd for nonexistantFiles
#!/bin/ksh
if [ -f existentFiles ]
then
rm existentFiles
fi
for a in /etc/magic /sbin/fsck /boot/grub/menu.lst /usr/share/games/wombat /var/cache/man/index.db /usr/bin/defcon
do
if ( ls $a > /dev/null 2>&1 )
then
echo $a >> existentFiles
fi
done
On my Mandrake box (using /bin/bash as the first line) I get:
$ cat existentFiles
/sbin/fsck
On my OpenBSD box (using /bin/ksh as the first line) I get: