Header Shadow Image


ksh and ksh93: 0: not found [No such file or directory]

When assigning values to an associative array in KSH, it's important to note the significance of the $ value:

 

# typeset -A ABCD; $(( ABCD["moi"]=0 )); $(( ABCD["moi"]++ )); $(( ABCD["moi"]++ )); $(( ABCD["moi"]++ )); print ${ABCD["moi"]};
/bin/ksh93u+: 0: not found [No such file or directory]
/bin/ksh93u+: 0: not found [No such file or directory]
/bin/ksh93u+: 1: not found [No such file or directory]
/bin/ksh93u+: 2: not found [No such file or directory]
3
#

The solution to the above, is of couse to use this logic (dropping the $ in front of the (( … )) statements):

# typeset -A ABCD; (( ABCD["moi"]=0 )); (( ABCD["moi"]++ )); (( ABCD["moi"]++ )); (( ABCD["moi"]++ )); print ${ABCD["moi"]};  
3
#

Cheers,
TK

Leave a Reply

 


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License