Skip to content

Instantly share code, notes, and snippets.

@ssledz
Created May 31, 2017 10:57
Show Gist options
  • Save ssledz/dff826c961b4c1796d7c6a8f25f57728 to your computer and use it in GitHub Desktop.
Save ssledz/dff826c961b4c1796d7c6a8f25f57728 to your computer and use it in GitHub Desktop.
#!/bin/bash
assert_exit_status() {
lambda() {
local val_fd=$(echo $@ | tr -d ' ' | cut -d':' -f2)
local arg=$1
shift
shift
local cmd=$(echo $@ | xargs -E ':')
local val=$(cat $val_fd)
eval $arg=$val
eval $cmd
}
local lambda=$1
shift
eval $@
local ret=$?
$lambda : <(echo $ret)
}
@ssledz
Copy link
Author

ssledz commented May 31, 2017

bash
. assert_exit_status.bash
assert_exit_status 'lambda status -> [[ $status -ne 0 ]] && echo Status is $status.' lls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment