[arch-general] OT: dash - looping through alphabet

lolilolicon lolilolicon at gmail.com
Sun Jul 6 12:59:01 EDT 2014


On Mon, Jul 7, 2014 at 12:23 AM, Ralf Mardorf
<ralf.mardorf at rocketmail.com> wrote:
> On Sun, 2014-07-06 at 21:16 +0800, lolilolicon wrote:
>> for i in $(seq 97 122); do
>>   printf "\x$(printf %x $i)\n"
>> done
>
> $ bash seq-dash
> a
> b
> [snip]
> x
> y
> z
> $ dash seq-dash
> \x61
> \x62
> [snip]
> \x78
> \x79
> \x7a

I didn't know dash's printf didn't support \x. Try octal then:

for i in $(seq 97 122); do
  printf "\\$(printf %o $i)\n"
done

> $ cat seq-dash
> for i in $(seq 97 122); do
>   printf "\x$(printf %x $i)\n"
> done
>
> :(
>
> Regards,
> Ralf
>


More information about the arch-general mailing list