mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-25 10:23:42 +01:00
Update snakify; add lispify
This commit is contained in:
parent
570fd71c76
commit
030006762e
12
lispify
Executable file
12
lispify
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Lispify - convert file names to-lisp-case
|
||||
filename=$(basename -- "$1")
|
||||
extension="${filename##*.}"
|
||||
filename="${filename%.*}"
|
||||
new_filename=$(echo ${filename// /-} | tr '_' '-' | tr -cd '[:alnum:]._-')
|
||||
new_basename=$(echo "$new_filename.$extension")
|
||||
mv -i "$1" "$new_basename"
|
||||
if ! [ "$new_basename" = "${new_basename:l}" ]; then
|
||||
mv -i "$new_basename" "${new_basename:l}"
|
||||
fi
|
4
snakify
4
snakify
@ -7,4 +7,6 @@ filename="${filename%.*}"
|
||||
new_filename=$(echo ${filename// /_} | tr '-' '_' | tr -cd '[:alnum:]._-')
|
||||
new_basename=$(echo "$new_filename.$extension")
|
||||
mv -i "$1" "$new_basename"
|
||||
mv -i "$new_basename" "${new_basename:l}"
|
||||
if ! [ "$new_basename" = "${new_basename:l}" ]; then
|
||||
mv -i "$new_basename" "${new_basename:l}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user