I am going to hell [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Wed 2004-11-10 14:16
I am going to hell
LinkReply
[identity profile] mobbsy.livejournal.comWed 2004-11-10 16:36
I'm sort of tangentially reminded of an amusing bit of sh I wrote a while ago. It's part of a "seq" work-alike that needed to generate fixed width numbers with arbitrary padding characters (so printf "%.nd" $x wasn't good enough).


### Some stuff to setup $prefix

x=$1

while [[ $x -le $2 ]]
do
echo ${prefix}${x}
ox=$x
x=$(( $x + 1 ))
if [[ $x < $ox ]]
then
prefix=$( echo $prefix | cut -c 2- )
fi
done
Link Reply to this
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]