Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bash

0 views
Skip to first unread message

jid...@jidanni.org

unread,
Dec 8, 2003, 3:25:19 PM12/8/03
to
A> Do you know any simple way to print from A to Z on the screen?
>> perl -wle 'for $i (A..Z){print $i}'
A> Any way to do it without perl?
for ((i=1;i<=26;i++)); do ... but without chr() it seems hard to do
all in bash alone. Sorry.

Charles Demas

unread,
Dec 8, 2003, 6:28:30 PM12/8/03
to

You should be able to do it with printf


Chuck Demas

--
Eat Healthy | _ _ | Nothing would be done at all,
Stay Fit | @ @ | If a man waited to do it so well,
Die Anyway | v | That no one could find fault with it.
de...@theworld.com | \___/ | http://world.std.com/~cpd

Chris F.A. Johnson

unread,
Dec 8, 2003, 6:30:35 PM12/8/03
to

printf "%s\n" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Or:

d2c()
{
eval _D2C=`printf "\$'\\\\\x%x'\n" $1`
[ ${SILENT_FUNCS:-0} -eq 1 ] || echo "$_D2C"
}

n=65
i=0
while [ $i -lt 26 ]
do
d2c $(( $n + $i ))
i=$(( $i + 1 ))
done

--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License

William Park

unread,
Dec 8, 2003, 10:20:19 PM12/8/03
to

With patched Bash (search this groups for the patch),
echo {A--Z}

--
William Park, Open Geometry Consulting, <openge...@yahoo.ca>
Linux solution for data management and processing.

Stephane CHAZELAS

unread,
Dec 9, 2003, 4:55:46 PM12/9/03
to
2003-12-09, 04:25(+08), jid...@jidanni.org:

> A> Do you know any simple way to print from A to Z on the screen?
[...]

awk 'BEGIN{for(i=1;i<=26;i++)printf "%c\n", i+64}'

zsh:

setopt braceccl
print -l {A-Z}

--
Stéphane ["Stephane.Chazelas" at "free.fr"]

0 new messages