#!/bin/sh ################################################################################ #ident "@(#) 1.0 ls(1) just directories 19930321 John S. Urban" # probably a much easier way to do this. ################################################################################ # given a list of commands, create a string @cmd@cmd@cmd@...@ where cmd is # present only if the command is found in the search path LIST(){ export A NAME for NAME in $* do A="`which $NAME 2>/dev/null`" [ "$A" != '' ] && (A="`basename $A`"; printf "@$A") done echo "@" } ################################################################################ # try wrapping the output into multiple columns COLS(){ case "`LIST cols column fmt`" in @cols@*)cols -d;; *@column@*)column;; *@fmt@*)fmt;; *)xargs -n 4;; esac } ################################################################################ ( ls -F $*|fgrep / echo ' ' ) | COLS ################################################################################