practize_1course/Pu240_798-811_TitovAA/172-68_h_Pu240_26-27/rename.zsh
2026-07-15 23:56:53 +03:00

30 lines
577 B
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/zsh
if [[ -z "$1" ]]; then
echo "You must specify the name prefix" 1>&2
echo 'E.g. prefix "my_prefix" :' 1>&2
echo 'h___фитирование.nb --> my_prefix_фитирование.nb' 1>&2
exit 1
fi
prefix="$1"
suffixes=(
"фитирование"
"pr_Qw2"
"pr_Qw1"
"osc_Qw2"
"osc_Qw1"
"gid_Qw2"
"gid_Qw1"
)
for suf in "${suffixes[@]}"; do
src="h____${suf}.nb"
dst="${prefix}_${suf}.nb"
if [[ -e "$src" ]]; then
mv -- "$src" "$dst"
else
echo "skipped \"$src\" due to absence"
fi
done