Results for var-ref.test.sh

statusoshosh-cpp
pass 2525
ok 22
total2727
caseoshosh-cppdescription
0pass pass var ref ${!a}
1pass pass ${!ref-default}
2pass pass ${!undef:-}
3pass pass comparison to ${!array[@]} keys (similar SYNTAX)
4pass pass ${!a[@]-'default'} is illegal
5pass pass var ref to $@ with @
6pass pass var ref to $1 and $2 with 1 and 2
7pass pass var ref: 1, @, *
8pass pass var ref to special var BASH_SOURCE
9pass pass var ref to $? with '?'
10pass pass Var ref, then assignment with ${ := }
11pass pass Var ref, then error with ${ ? }
12pass pass Indirect expansion, THEN suffix operators
13pass pass var ref OF array var -- silent a[0] decay
14pass pass array ref
15pass pass array ref with strict_array
16pass pass var ref TO array var
17pass pass var ref TO array var, with subscripts
18pass pass var ref TO assoc array a[key]
19pass pass var ref TO array with arbitrary subscripts
20pass pass Bizarre tilde expansion in array index
21pass pass Indirect expansion TO fancy expansion features bash disallows
22ok ok Bad var ref
detailsdetails
23ok ok Bad var ref 2
detailsdetails
24pass pass ${!OPTIND} (used by bash completion
25pass pass var ref doesn't need cycle detection
26pass pass Var Ref Code Injection $(tee PWNED)
50 passed, 4 OK, 0 not implemented, 0 BUG, 0 failed, 0 timeouts, 0 cases skipped

Details on runs that didn't PASS

osh22 Bad var ref

stdout:
stderr: 
  bad var name
     ^
[ contents of var 'a' at line 2 of [ stdin ] ]:1: Expected end of var ref expression
  echo ref ${!a}
              ^
[ stdin ]:2: fatal: Invalid var ref expression
osh-cpp22 Bad var ref

stdout:
stderr: 
  bad var name
     ^
[ contents of var 'a' at line 2 of [ stdin ] ]:1: Expected end of var ref expression
  echo ref ${!a}
              ^
[ stdin ]:2: fatal: Invalid var ref expression
osh23 Bad var ref 2

stdout:
stderr: 
  /
  ^
[ contents of var 'b' at line 2 of [ stdin ] ]:1: Expected var name
  echo ref ${!b}
              ^
[ stdin ]:2: fatal: Invalid var ref expression
osh-cpp23 Bad var ref 2

stdout:
stderr: 
  /
  ^
[ contents of var 'b' at line 2 of [ stdin ] ]:1: Expected var name
  echo ref ${!b}
              ^
[ stdin ]:2: fatal: Invalid var ref expression