Re: OT: dash - looping through alphabet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



# ralf.mardorf@xxxxxxxxxxxxxx / 2014-07-05 22:44:20 +0200:
> Hi!
> 
> Sorry, it's OT for this list, but I didn't find an answer in the
> Internet.
> 
> What's the syntax for a loop from "a" to "z" in dash?

for c in $(printf "%b\n" $(printf "\\\0%o\n" $(seq 97 122))); do
  ...
done

for some reason, while dash(1) claims %c in printf(1) behaves just like
in C, `printf "%c" 97` gives "9" (`printf("%c", 97)` in C gives "a").
this behavior is consistent across bash, dash, pdksh, posh, tcsh, zsh.

-- 
roman


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux