diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2015-09-16 14:07:23 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2015-09-16 14:07:23 +0200 |
commit | 17e59dbadbff1c8d68b794aa77fe3002e6362375 (patch) | |
tree | 24f94d04de7d30e1287eac2c38ab6d1f6ab12068 | |
parent | 48dbfe42f98ccc3fc17aad156d0f2be3e60e1407 (diff) |
Add builtin "exit" with ability to "exit 1"
-rwxr-xr-x | nix-script-repl.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nix-script-repl.sh b/nix-script-repl.sh index 027dadc..5e52851 100755 --- a/nix-script-repl.sh +++ b/nix-script-repl.sh @@ -104,6 +104,12 @@ __debugging() { esac } +__exit() { + stdout "Ready. Bye-Bye!" + [[ -z "$1" ]] && exit 0 + exit $1 +} + __builtin__() { local str=$1; shift local cmd=$1; shift @@ -115,9 +121,8 @@ __builtin__() { prompt while read COMMAND ARGS do - [[ $COMMAND =~ "quit" || $COMMAND =~ "exit" ]] && break - __builtin__ "help" usage $ARGS && continue + __builtin__ "exit" __exit $ARGS && continue __builtin__ "list" __list $ARGS && continue __builtin__ "verbosity" __verbosity $ARGS && continue __builtin__ "debugging" __debugging $ARGS && continue @@ -146,5 +151,3 @@ do prompt done -stdout "Ready. Bye-Bye!" - |