diff options
| author | Suleyman Farajli <suleyman@farajli.net> | 2025-11-25 18:47:27 +0400 |
|---|---|---|
| committer | Suleyman Farajli <suleyman@farajli.net> | 2025-11-25 18:47:27 +0400 |
| commit | d947956270b092df10637bb3531441caca698b86 (patch) | |
| tree | 8c32170ef044687b11be79398140a36430e2ff0a /scripts/cli/nospac | |
| parent | c388ade6b6d955138698731af02dfbe5c676439a (diff) | |
feat: new api for scripts
Diffstat (limited to 'scripts/cli/nospac')
| -rwxr-xr-x | scripts/cli/nospac | 11 |
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 ' ' '_') |
