| 1 | #!/usr/bin/env bash | 
| 2 | # | 
| 3 | # Usage: | 
| 4 | # demo/06-history.sh <function name> | 
| 5 | # | 
| 6 | # TODO: move into test/gold -- OSH doesn't have histexpand. | 
| 7 | |
| 8 | set -o nounset | 
| 9 | set -o pipefail | 
| 10 | set -o errexit | 
| 11 | |
| 12 | main() { | 
| 13 | echo hi | 
| 14 | # Does this work non interacitvely? Nope. | 
| 15 | echo !$ | 
| 16 | echo !! | 
| 17 | |
| 18 | # Hm this doesn't work either? It's only for turning OFF in interactive | 
| 19 | # shells maybe? | 
| 20 | set -o histexpand | 
| 21 | |
| 22 | echo hi | 
| 23 | echo !$ | 
| 24 | echo !! | 
| 25 | } | 
| 26 | |
| 27 | "$@" |