Skip to content

Instantly share code, notes, and snippets.

@dualbus
Created January 9, 2015 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dualbus/87ee24145896b4e2d250 to your computer and use it in GitHub Desktop.
Save dualbus/87ee24145896b4e2d250 to your computer and use it in GitHub Desktop.
#!/bin/bash
shopt -s extdebug extglob
k0ud3() {
local cmd=$1
case $cmd in
+([[:digit:]])@([*+/-])+([[:digit:]])):;;
*)! :;;
esac && eval echo "$(($cmd))"
}
trap 'k0ud3 "$BASH_COMMAND"; ! :' DEBUG
@izabera
Copy link

izabera commented Jan 10, 2015

k0ud3() (echo $(($*))) 2>/dev/null

@izabera
Copy link

izabera commented Jan 10, 2015

shopt -s extdebug; trap '(echo $((BASH_COMMAND))) 2>/dev/null; ! :' DEBUG ^_^

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