[xubuntu-users] dash - looping through alphabet

Steve Litt slitt at troubleshooters.com
Sun Jul 6 18:00:54 UTC 2014


On Sun, 06 Jul 2014 07:26:34 +0200
Ralf Mardorf <ralf.mardorf at rocketmail.com> wrote:

> On Sat, 2014-07-05 at 19:49 -0400, Steve Litt wrote:
> > I couldn't get anything to work without putting spaces between every
> > letter from a to z.
> 
> Thank you,
> 
> but if this is needed, then I don't want to use a loop, but do it this

I might have an easy way to insert the spaces. Read on...

[clip]

> 
> >  Would you consider a C solution?
> 
> No, it should be a shell script and for this script I prefer dash over
> bash, since the scrip should do several other operations, it should be
> easy to modify it and it should be fast.
> 
> I tried another loop, but it also doesn't work.
> 
> $ cat while-dash 
> i=97
> while [ $i != 123 ]; do
>   printf "\x$(printf %x $i)"
>   i=$((i+1))
> done
> printf "\n"
> exit
> 
> $ bash ./while-dash 
> abcdefghijklmnopqrstuvwxyz
> $ dash ./while-dash 
> \x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72
> \x73\x74\x75\x76\x77\x78\x79\x7a





SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance





More information about the xubuntu-users mailing list