aboutsummaryrefslogtreecommitdiff
path: root/env/.local/bin/scripts/math
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2025-06-04 10:16:12 -0500
committericeyrazor <iceyrazor@mailfence.com>2025-06-04 10:16:12 -0500
commitb69040fda091cb2a55e00c05e924cd0c0a42cb57 (patch)
tree7b6c8282841c2f6a3767c12d5d8bd053847454e9 /env/.local/bin/scripts/math
parentedf3d20945518c55394975b3641229124776d195 (diff)
fixed awesome autostart dir. added wallpaper setter script. made no extension be filetype sh in neovim. renamed some scripts.
Diffstat (limited to 'env/.local/bin/scripts/math')
-rwxr-xr-xenv/.local/bin/scripts/math13
1 files changed, 13 insertions, 0 deletions
diff --git a/env/.local/bin/scripts/math b/env/.local/bin/scripts/math
new file mode 100755
index 0000000..26d4854
--- /dev/null
+++ b/env/.local/bin/scripts/math
@@ -0,0 +1,13 @@
+#!/bin/bash
+expression=$1
+precision=$2
+
+if [ "$precision" == "" ]; then
+ precision=1;
+fi;
+
+# Perform arithmetic operation using awk
+result=$(awk "BEGIN {printf \"%.${precision}f\n\", $expression}" | sed 's/\.0$//')
+
+# Print the result
+echo "$result"