Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.unix.internals Subject: Re: Received: Message-ID: Date: 9 Sep 90 13:25:35 GMT References: <24418@adm.BRL.MIL> <1990Sep9.004235.11572@usenet.ins.cwru.edu> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 62 In article <1990Sep9.004235.11572@usenet.ins.cwru.edu> chet@po.CWRU.Edu writes: > Peter da Silva writes: > $ ls() > $ { > $ for i > $ do > $ echo $i > $ done > $ } > Useful, that. When hacking around on a floppy-booted UNIX system, yes. > Creative use of `[ -f $i -o -d $i ]' is needed, I think. Well, it might be desirable, but anyone screwing with the UNIX on their boot floppy is probably up to noticing the difference. But, if you insist: # Anal-retentive ls() for boot floppies... dare to type it in! # # UNTESTED!!!!! # ls() { RECURSE=-d TYPE=0 DIR=0 for i do case ".$i" in .-F) TYPE=1;; .-R) RECURSE=;; .-d) DIR=1;; .-*) echo "Option $i not implemented.";; *) if [ -f $i -o -d $i ] then if [ $TYPE = 1 -a -x $i ] then echo "$i*" elif [ $TYPE = 1 -a $DIR = 1 -a -d $i ] then echo "$i/" elif [ $DIR = 0 -a -d $i ] then DIRS="$DIRS $i" else echo "$i" fi else echo "$i not found" fi ;; esac done for i in $DIRS do echo "\n$i:" ls $RECURSE $i done } -- Peter da Silva. `-_-' +1 713 274 5180. 'U` peter@ferranti.com