baslinux AT lists.ibiblio.org
Subject: Baslinux mailing list
List archive
- From: Lee Forrest <lforrestster AT gmail.com>
- To: BasicLinux List <baslinux AT lists.ibiblio.org>
- Subject: Re: [BL] Simple File Manager 44
- Date: Fri, 2 Feb 2007 22:41:39 +0000
On Sat, Feb 03, 2007 at 06:43:13PM +1300, 3aoo-cvfd AT dea.spamcon.org wrote:
> > > 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
> >
> > [11] /var [: 0: unknown operand
> >
> > It turns out to be a bug in the dc in BL3 busybox.
>
> You can get the script to work on BL3, by replacing the
> dc line with this:
> ------------------------------------------------------------
> case $num in 4|8|12|16|20|24|28|32|36|40|44|48|52|56|60)echo
> esac
> ------------------------------------------------------------
>
> It's not very elegant, but at least it works on BL3.
I beg to differ. That is a _most_ elegant hack.
This works beautifully:
#!/bin/sh
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"
case "$num" in
4|8|12|16|20|24|28|32|36|40|44|48|52|56|60) echo ;;
esac
num=`expr $num + 1`
done
----------------
[1] / [2] /bin [3] /dev [4] /etc
[5] /home [6] /lib [7] /proc [8] /root
[9] /sbin [10] /usr [11] /var [12] ..
[13] cardmgr [14] chat [15] install-to-hd [16] lsof
[17] nc@ [18] pppd [19] pure-authd [20] pure-ftpd
[21] pure-ftpwho [22] pure-mrtginfo [23] pure-quotacheck[24]
pure-uploadscript
[25] receive [26] send [27] tcpdump [28] special/
I sure appreciate the help, Steven. Now I will sit down and play
with your formatting improvements until I understand them.
I saw your posts on dc, about needing the p option. I'd have never figured
that
out.
But I like your case hack (it _would_ be more portable) and now I
have _two_ ways to do the same thing, which means that I'll have
an easier time understanding what's going on.
And I now know I have a commandline calculator.
Although I discovered you could do that with calctool, basically.
Now give me one good reason why I should keep calctool around since I
have dc! I do not do fancy mathemtics. Simple algebra is about it, and
all that needs is * and / and + and - and square root, all of which
dc does....
Lee
--
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru
-
Re: [BL] long filenames 34
, (continued)
-
Re: [BL] long filenames 34,
3aoo-cvfd, 02/01/2007
-
[BL] DOS & Shell Scripting Guide (was: long file names) 3C,
Lee Forrest, 02/01/2007
- Re: [BL] DOS & Shell Scripting Guide (was: long file names) 3C, Karolis Lyvens, 02/02/2007
-
Re: [BL] DOS & Shell Scripting Guide (was: long file names) 3C,
Ron Clarke, 02/02/2007
-
Re: [BL] DOS & Shell Scripting Guide 40,
Lee Forrest, 02/02/2007
-
Message not available
- Re: [BL] DOS & Shell Scripting Guide 41, Lee Forrest, 02/02/2007
- Re: [BL] DOS & Shell Scripting Guide 41, 3aoo-cvfd, 02/02/2007
- [BL] Simple File Manager (was: DOS & Shell Scripting Guide), Lee Forrest, 02/02/2007
- Message not available
- Re: [BL] Simple File Manager 42, Lee Forrest, 02/03/2007
- Re: [BL] Simple File Manager (was: DOS & Shell Scripting Guide), 3aoo-cvfd, 02/03/2007
- Re: [BL] Simple File Manager 44, Lee Forrest, 02/03/2007
- Message not available
- Re: [BL] Simple File Manager 45, Lee Forrest, 02/03/2007
- Re: [BL] Simple File Manager, 3aoo-cvfd, 02/03/2007
- Re: [BL] Simple File Manager 46, Lee Forrest, 02/03/2007
-
Message not available
-
Re: [BL] DOS & Shell Scripting Guide 40,
Lee Forrest, 02/02/2007
-
[BL] DOS & Shell Scripting Guide (was: long file names) 3C,
Lee Forrest, 02/01/2007
-
Re: [BL] long filenames 34,
3aoo-cvfd, 02/01/2007
Archive powered by MHonArc 2.6.24.