Zsh: Turn machklein.sh into a function and name it mksmol
This commit is contained in:
parent
ecaa328333
commit
b43d99f9a1
|
@ -80,6 +80,8 @@ alias wget_leech='wget --no-directories --page-requisites --span-hosts'
|
|||
|
||||
alias cat='cat-highlight'
|
||||
|
||||
alias machklein='mksmol'
|
||||
|
||||
# OS specific settings.
|
||||
case $(lsb_release -i -s 2> /dev/null) in
|
||||
Gentoo)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/zsh
|
||||
# Various functions, to be sourced.
|
||||
# Various small functions
|
||||
|
||||
# Get backtrace from gdb.
|
||||
function gdb_get_backtrace()
|
||||
|
@ -51,3 +51,18 @@ function cat-highlight()
|
|||
\cat $@
|
||||
fi
|
||||
}
|
||||
|
||||
# Makes all files in DIR lower case. Works with Non-ASCII characters.
|
||||
function mksmol()
|
||||
{
|
||||
if [[ ${ARGC} -ne 1 ]]; then
|
||||
echo "usage: ${0} DIR" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local dir="${1}"
|
||||
for file in "${dir}"/*; do
|
||||
newfile="${file:l}"
|
||||
[[ "${file}" != "${newfile}" ]] && mv "${file}" "${newfile}" || :
|
||||
done
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/zsh
|
||||
|
||||
if [[ -z "${1}" ]]; then
|
||||
echo "usage: ${0} DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
dir="${1}"
|
||||
|
||||
for file in "${dir}"/*; do
|
||||
newfile="${file:l}"
|
||||
[[ "${file}" != "${newfile}" ]] && mv "${file}" "${newfile}" || echo -n
|
||||
done
|
Loading…
Reference in New Issue
Block a user