summaryrefslogtreecommitdiffstats
path: root/sample-commands/calc.sh
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-04-08 16:59:25 +0200
committerJoas Schilling <coding@schilljs.com>2019-04-08 17:00:54 +0200
commite267c6be4fe7bf116e64d50a0e08d8dee839d3bd (patch)
treeac580ef6eb9a50983cbad4bcb85d49e7f813244e /sample-commands/calc.sh
parent074d5e306296d63c9163401cbd385b498b23fa8c (diff)
More verbose feedback on sample commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'sample-commands/calc.sh')
-rw-r--r--[-rwxr-xr-x]sample-commands/calc.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/sample-commands/calc.sh b/sample-commands/calc.sh
index 7ec3c6301..73c514867 100755..100644
--- a/sample-commands/calc.sh
+++ b/sample-commands/calc.sh
@@ -1,4 +1,11 @@
#!/usr/bin/env bash
+
+CALCULATOR=$(which "bc")
+if ! [ -x "$CALCULATOR" ]; then
+ echo "Basic calculator package (bc - https://www.gnu.org/software/bc/) not found"
+ exit 1
+fi
+
while test $# -gt 0; do
case "$1" in
--help)
@@ -16,13 +23,6 @@ while test $# -gt 0; do
esac
done
-CALCULATOR=$(which "bc")
-if ! [ -x "$CALCULATOR" ]; then
- echo "Basic calculator package (bc) not found"
- exit 1
-fi
-
-
set -f
echo "$@ ="
echo $(echo "$@" | bc)