summaryrefslogtreecommitdiff
path: root/scripts/cli/nospac
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cli/nospac')
-rwxr-xr-xscripts/cli/nospac11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/cli/nospac b/scripts/cli/nospac
index 6ba466a..7ee5b36 100755
--- a/scripts/cli/nospac
+++ b/scripts/cli/nospac
@@ -1,5 +1,7 @@
#!/bin/sh
+. "lib_common.sh"
+
help() {
cat << EOF
${0}: Replace all the spaces in file and directory
@@ -7,13 +9,12 @@ names with "_" in in the current directory.
options:
-h Print this message and exit
EOF
+exit 0
}
-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
+[ "${1}" = "-h" ] && help
+
+[ ${#} -gt 0 ] && invalid_use
for file in ./*; do
newfile=$(echo "${file}" | tr ' ' '_')