commit 6f08608813dc1aa675901995ed4dafacce96adad
parent 56635ad6d39427620a4fb12a084eadfacfd5c7c6
Author: Ed van Bruggen <edvb54@gmail.com>
Date: Wed, 2 Nov 2016 19:50:00 -0700
Update calc to use dmenucmd var
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/calc.sh b/calc.sh
@@ -1,10 +1,12 @@
#!/usr/bin/env bash
# Calculator using dmenu as an interface
+dmenucmd="dmenu -p Calc $@"
+
# run dmenu calculator while the result is not empty
while : ; do
# use contents of clipboard as option, pass into bc to be calculated
- result=$(xsel -o -b | dmenu -p Calc | xargs echo | bc 2>&1)
+ result=$(xsel -o -b | $dmenucmd | xargs echo | bc 2>&1)
if [[ $result ]]; then # if result is empty (the last one), don't copy it to clipboard
printf "$result" | xsel -b
fi