![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 2 | 4 Weeks Ago 05:12 PM |
| how to? launch command with string of command line options | TinCanFury | Shell Programming and Scripting | 5 | 04-28-2008 03:06 PM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | Linux | 5 | 07-30-2007 05:26 AM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | HP-UX | 1 | 10-16-2006 01:16 PM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | Shell Programming and Scripting | 0 | 09-19-2006 06:44 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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' /etc/magic /sbin/fsck /boot/grub/menu.lst /usr/share/games/wombat /var/cache/man/index.db /usr/bin/defcon 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 Please help |
| Forum Sponsor | ||
|
|
|
|||
|
Code:
#!/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
Code:
$ cat existentFiles /sbin/fsck Code:
$ cat existentFiles /etc/magic /sbin/fsck |
|||
| Google UNIX.COM |