From owner-freebsd-questions Thu May 15 07:23:50 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id HAA20411 for questions-outgoing; Thu, 15 May 1997 07:23:50 -0700 (PDT) Received: from mail.EUnet.hu (www.eunet.hu [193.225.28.100]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id HAA20394 for ; Thu, 15 May 1997 07:23:46 -0700 (PDT) Received: by mail.EUnet.hu, id QAA18271; Thu, 15 May 1997 16:23:32 +0200 Received: (from zgabor@localhost) by CoDe.hu (8.7.5/8.7.3) id OAA00607; Thu, 15 May 1997 14:38:18 +0200 (MET DST) From: Zahemszky Gabor Message-Id: <199705151238.OAA00607@CoDe.hu> Subject: Re: parameter expansion To: freebsd-questions@freebsd.org (FreeBSD questions) Date: Thu, 15 May 1997 14:38:17 +0200 (MET DST) Cc: un_x@anchorage.net In-Reply-To: from Steve Howe at "May 14, 97 12:00:30 pm" X-Mailer: ELM [version 2.4ME+ PL11 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > #!/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"