Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 May 1997 14:38:17 +0200 (MET DST)
From:      Zahemszky Gabor <zgabor@CoDe.hu>
To:        freebsd-questions@freebsd.org (FreeBSD questions)
Cc:        un_x@anchorage.net
Subject:   Re: parameter expansion
Message-ID:  <199705151238.OAA00607@CoDe.hu>
In-Reply-To: <Pine.BSF.3.95q.970514114558.15079A-100000@aak.anchorage.net> from Steve Howe at "May 14, 97 12:00:30 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> #!/bin/ksh
> Z='21N16I25C25E30, 40M30E33E25T15U!' ;IFS=' ABCDEFGHIJKLMNOPQRSTUVWXYZ ';
> set $Z;for i { [[ $i = ? ]]&&print $i&&break;[[ $i = ??? ]]&&j=$i&&i=${i%?};
> typeset -i40 i=8#$i;print -n ${i#???};[[ "$j" = ??? ]]&&print -n "${j#??} "&&
> j=;typeset +i i;};IFS=' 0123456789 ';set $Z;X=;for i { [[ $i = , ]]&&i=2;
> [[ $i = ?? ]]||typeset -l i;X="$X $i";typeset +l i;};print "$X"
> 
> i tried this thing with sh - but only got errors :(
> (i was a little scared it would do something evil!)

Well, try to break that long line into shorter ones, eg:
sed -e 's/;/\
/g' my_signature_file

It's a bit more readable ...
And what was the eror message?

> i don't have ksh ...

Get the pdksh package (or port), or the last version (5.2.12) from it's
main site:  ftp://ftp.cs.mun.ca:/pub/pdksh
(Of course, I wrote that neither bash nor zsh can handle this - if I know
well - neither of them is a real ksh.)  Or get the real AT&T ksh (the BSDI
or the Linux version) , from http://www.research.att.com/orgs/ssr/reuse/ - 
There is the last ksh93 version, which has very interesting features in it.
But the source is missing :-(

Bye, Gabor
--
#!/bin/ksh
Z='21N16I25C25E30, 40M30E33E25T15U!' ;IFS=' ABCDEFGHIJKLMNOPQRSTUVWXYZ ';set $Z;for i { [[ $i = ? ]]&&print $i&&break;[[ $i = ??? ]]&&j=$i&&i=${i%?};typeset -i40 i=8#$i;print -n ${i#???};[[ "$j" = ??? ]]&&print -n "${j#??} "&&j=;typeset +i i;};IFS=' 0123456789 ';set $Z;X=;for i { [[ $i = , ]]&&i=2;[[ $i = ?? ]]||typeset -l i;X="$X $i";typeset +l i;};print "$X"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705151238.OAA00607>