summaryrefslogtreecommitdiff
path: root/scripts/cli/nospac
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
commitcb78290f31886fb1f9a5e7c2a764dda55a459e50 (patch)
tree72a2df0645405658d8590d4b8d7d87f1e099f596 /scripts/cli/nospac
parentf8d1bfbd0f27e0763cf75fcda58d010e346515ab (diff)
chore: split script installation into CLI and GUI sections
Diffstat (limited to 'scripts/cli/nospac')
-rwxr-xr-xscripts/cli/nospac23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/cli/nospac b/scripts/cli/nospac
new file mode 100755
index 0000000..6ba466a
--- /dev/null
+++ b/scripts/cli/nospac
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+help() {
+cat << EOF
+${0}: Replace all the spaces in file and directory
+names with "_" in in the current directory.
+options:
+ -h Print this message and exit
+EOF
+}
+
+if [ ${#} -gt 0 ]; then
+ [ ${#} = 1 ] && [ "${1}" = "-h" ] && help && exit 0
+ printf "%s: Invalid usage\nTry '%s -h' for help.\n" "${0}" "${0}"
+ exit 1
+fi
+
+for file in ./*; do
+ newfile=$(echo "${file}" | tr ' ' '_')
+ [ "${newfile}" != "${file}" ] && mv -v "${file}" "${newfile}"
+done
+
+exit 0