bash : name : fix specifying names with spaces.

This commit is contained in:
Dmitry Voronin 2023-10-29 22:08:51 +03:00
parent 523404ecb3
commit da36d0093f

View file

@ -5,6 +5,7 @@ name()
local files="$@" local files="$@"
local count=0 local count=0
local total=$# local total=$#
local IFS=$'\n'
# all files except hidden by default. # all files except hidden by default.
if [[ "${files}" = "" ]]; then if [[ "${files}" = "" ]]; then
@ -57,6 +58,7 @@ name_hash()
local files="$@" local files="$@"
local count=0 local count=0
local total=$# local total=$#
local IFS=$'\n'
# all files except hidden by default. # all files except hidden by default.
if [[ "${files}" = "" ]]; then if [[ "${files}" = "" ]]; then
@ -109,6 +111,7 @@ name_hash_check()
local count=0 local count=0
local total=$# local total=$#
local failed=0 local failed=0
local IFS=$'\n'
# all files by default. # all files by default.
if [[ "${files}" = "" ]]; then if [[ "${files}" = "" ]]; then
@ -158,6 +161,7 @@ name_series()
local files="${@:2}" local files="${@:2}"
local count=0 local count=0
local total=$# local total=$#
local IFS=$'\n'
# error when no season number specified. # error when no season number specified.
if [[ "${season}" = "" ]]; then if [[ "${season}" = "" ]]; then
@ -200,6 +204,7 @@ name_manga()
local count=0 local count=0
local total=$# local total=$#
local manga="${PWD##*/}" local manga="${PWD##*/}"
local IFS=$'\n'
# error when no season number specified. # error when no season number specified.
if [[ "${season}" = "" ]]; then if [[ "${season}" = "" ]]; then
@ -241,6 +246,7 @@ name_ext()
local files="${@:2}" local files="${@:2}"
local count=0 local count=0
local total=$# local total=$#
local IFS=$'\n'
# error when no new extension specified. # error when no new extension specified.
if [[ "${extension}" = "" ]]; then if [[ "${extension}" = "" ]]; then