All pastes #242130 Raw Edit

Stuff

public shellscript v1 · immutable
·published 2006-11-06 23:00 UTC
rendered paste body
#!/bin/bashARRAY_GetArrays(){  return 1}function ARRAY_New(){  if [[ $1 != '' ]]  then    eval "      function ARRAY_GetArrays()      {        builtin echo '$@' '$(ARRAY_GetArrays)'        return 0      }    "  fi}function ARRAY_Get(){  return 1}function ARRAY_Let(){  return 0  # WHAT THE HELL TO DO HERE? IT SEEMS TO BE A SORT OF "BRAINFUCK"  # SEE THE FINAL ARRAY_Let() BELOW...}ARRAY_New 'foo'#          ^^^ Array names can not have space in them...ARRAY_New 'bar'ARRAY_GetArrays # Prints array names...# -----------------------------------------------------------ARRAY_Let 'foo' 'test 1' 'tset 1' #                ^^^^^^ Index names can have any character in them...ARRAY_Let 'foo' 'test 2' 'tset 2'ARRAY_Let 'foo' 'test 3' 'tset 3'ARRAY_Let 'bar' 'hokus 1' 'sukoh 1'ARRAY_Let 'bar' 'hokus 2' 'sukoh 2'ARRAY_Let 'bar' 'hokus 3' 'sukoh 3'# ------------------------------------------------------------# THIS IS WHAT THE RESULTING FUNCTION SHOULD BE LIKEARRAY_Get(){  case $1 in    'foo x')      case $2 in        'test 1') echo 'tset 1';;        'test 2') echo 'tset 2';;        'test 3') echo 'tset 3';;      esac      ;;    'bar y')      case $2 in        'hokus 1') echo 'sukoh 1';;        'hokus 2') echo 'sukoh 2';;        'hokus 3') echo 'sukoh 3';;      esac      ;;  esac}ARRAY_Get 'bar y' 'hokus 3'exit 0