Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ncoast!allbery From: robertd@ncoast.UUCP (Rob DeMarco) Newsgroups: comp.sources.misc Subject: ils - enhanced ls Message-ID: <4524@ncoast.UUCP> Date: Mon, 14-Sep-87 21:13:09 EDT Article-I.D.: ncoast.4524 Posted: Mon Sep 14 21:13:09 1987 Date-Received: Wed, 16-Sep-87 02:14:35 EDT Sender: allbery@ncoast.UUCP Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 148 Approved: allbery@ncoast.UUCP X-Archive: comp.sources.misc/8709/7 I wrote this as an enhanced feature of ls useful in an interactive shell. It is basically useless in a shell script - though, of course, it will work. Program follows: # ILS - SHELL VERSION 1.0 # WRITEN BY ROB DEMARCO (ncoast!robertd)# # Usage: # ils # ils file/dir1 file/dir2.... # ils -contents dir1 dir2.. +contents # ils -pager n # ils -80 # ils -exec file1 file2... +exec # ils -silent # # Take care of line flags export PATH || (echo "OOPS! This is not shell. Desperation time. I will feed my self to sh." ; sh $0 ; kill $$) perm=0 ; pager=0 ; width=40 ; execflag=0 ; contents=0 ; switch=0 ; line=0 ; cflag=0 ; sflag=0 if [ "$1" = "" ] ; then head="`ls | head -1`" shead="`echo \"$head\" | cut -c1`" if [ "$shead" = "-" ] ; then set -- * shift else set * fi if [ "$1" = "" ] ; then exit 3 fi fi while [ "`echo \"$1\"|cut -c1`" = "-" ];do if [ "$1" = "-pager" ] ; then shift pager=$1 starter="$starter -pager $1" shift continue fi if [ "$1" = "-silent" ] ; then sflag=1 starter="$starter -silent" shift continue fi if [ "$1" = "-80" ] ; then width=80 starter="$starter -80" shift continue fi if [ "$1" = -contents ] ; then contents=1 shift continue fi if [ "$1" = -exec ] ; then execflag=1 shift continue fi break done for file_dir in $@ ; do if [ "$file_dir" = -exec ] ; then execflag=1 shift continue fi if [ "$file_dir" = -contents ] ; then contents=1 shift continue fi if [ "$file_dir" = +exec ] ; then execflag=0 shift continue fi if [ "$file_dir" = +contents ] ; then contents=0 shift continue fi if [ $execflag = 0 ] ; then if [ -f "$file_dir" ] ; then echo "`wc $file_dir`\c" elif [ -d $file_dir -a $contents = 0 ] ; then echo "\t