commit d3fe0ff1f783e028f7be3e861d627bc9f12ef22e parent 44e5dd10de9dc01eb905a4670c0fa09c5f9383b5 Author: Ed van Bruggen <edvb54@gmail.com> Date: Sat, 25 Apr 2015 21:59:59 -0700 Add dmenu-calc.sh file, dmenu calculator Diffstat:
dmenu-calc.sh | | | 11 | +++++++++++ |
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/dmenu-calc.sh b/dmenu-calc.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Caluctor using dmenu as interface + +# run dmenu calculator while the result is not empty +while : ; do + result=$(xclip -o -sel clip | dmenu -p Calc | xargs echo | bc 2>&1) + if [[ $result ]]; then # if result is not empty (the last one), copy to clipboard + echo $result | xclip -sel clip + fi + [[ $result ]] || break # if result is empty, break from while loop +done