Skip to Content.
Sympa Menu

baslinux - Re: [BL] DOS & Shell Scripting Guide 41

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: 3aoo-cvfd AT dea.spamcon.org
  • To: qx84-pvhu AT dea.spamcon.org
  • Cc: BasicLinux List <baslinux AT lists.ibiblio.org>
  • Subject: Re: [BL] DOS & Shell Scripting Guide 41
  • Date: Sat, 03 Feb 2007 15:54:02 +1300

Lee Forrest wrote:
>
> Do you know how to turn that mess into, say, 4 neat columns,
> with printf? I'd love to be able to do that.

clear
num=1
set "/" "/bin" "/dev" "/etc" "/home" "/lib" "/proc" "/root" "/sbin" "/usr"
"/var" ".." `/bin/ls -F`
for file in "$@" ; do
printf "%-20s" "[${num}] $file"
[ `dc $num 4 mod` = 0 ] && echo
num=`expr $num + 1`
done


Cheers,
Steven




Archive powered by MHonArc 2.6.24.

Top of Page