#!/bin/bash
# Desc: Zero-pad working dir files with initial digits for sorting
# Usage: zeropad.sh
-# Version: 0.0.4
+# Version: 0.0.5
list_files() {
# Desc: Lists working directory file basenames
# Construct the new filename
new_file="${padded_digits}${file#${digits}}";
# Rename the file
+ if [[ "$file" == "$new_file" ]]; then continue; fi;
mv -n "$file" "$new_file"
# declare -p file new_file; # debug
done < <(list_files);