Hi,

> The problem seems to be that you are using "${v+set}" rather than 
> "${v}set" .

No. Do you understand what does "${v+set}" mean?
Please reopen this bug.

I want use this trick to avoid additional first blank line
in the following script with ksh:

  
https://github.com/fumiyas/fumiyas.github.io/blob/master/2015/12/02/ldifunwrap.sh

On Solaris 10:

$ uname -a
SunOS build-sol10 5.10 Generic_144501-19 i86pc i386 i86pc
$ for s in '' ba k z; do
 sh=${s}sh
 echo -n $sh:
 seq 4 |${s}sh -c 'unset v; while read n; do [ -n "${v+set}" ] && printf "%s " 
"$v "; v="$n"; done; echo "$v"'
done
sh:1  2  3  4
bash:1  2  3  4
ksh:1  2  3  4
zsh:1  2  3  4

On AIX 6.1:

$ uname -a
AIX build-aix6 1 6 00CF28B34C00
$ for s in '' ba k z; do
 sh=${s}sh
 echo -n $sh:
 seq 4 |${s}sh -c 'unset v; while read n; do [ -n "${v+set}" ] && printf "%s " 
"$v "; v="$n"; done; echo "$v"'
done
sh:1  2  3  4
bash:1  2  3  4
ksh:1  2  3  4
zsh:1  2  3  4

-- 
-- Name: SATOH Fumiyasu @ OSS Technology Corp. (fumiyas @ osstech co jp)
-- Business Home: http://www.OSSTech.co.jp/
-- GitHub Home: https://GitHub.com/fumiyas/
-- PGP Fingerprint: BBE1 A1C9 525A 292E 6729  CDEC ADC2 9DCA 5E1C CBCA

Reply via email to