Skip to content
Snippets Groups Projects
Commit 3a0ac330 authored by Michael Aaron Murphy's avatar Michael Aaron Murphy Committed by GitHub
Browse files

Merge pull request #431 from drosseau/master

Added not builtin
parents f81ae9bd 68410f0d
No related branches found
No related tags found
No related merge requests found
not true || echo not true
not false && echo not false
true && not false && echo true and not false
not test -z "a" && echo not test
not echo hello
echo $?
\ No newline at end of file
not true
not false
true and not false
not test
hello
-1
......@@ -193,6 +193,20 @@ impl Builtin {
});
/* Misc */
commands.insert("not",
Builtin {
name: "not",
help: "Reverses the exit status value of the given command.",
main: Box::new(|args: &[&str], shell: &mut Shell| -> i32 {
let cmd = args[1..].join(" ");
shell.on_command(&cmd);
match shell.previous_status {
SUCCESS => FAILURE,
FAILURE => SUCCESS,
_ => shell.previous_status
}
}),
});
commands.insert("set",
Builtin {
name: "set",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment