Return to Snippet

Revision: 21717
at December 18, 2009 23:12 by tm


Updated Code
# Find all files (and directories) in the current directory (cwd) which are
# 'equivalent' wrt. case. E.g. foo =~ FOO =~ foO ...
shopt -s nocasematch; unset a
for f in *; do
    for e in "${a[@]}"; do
        if [[ "$f" == "$e" ]]; then
            echo "'$f' equivalent to '$e'"
            # break out and continue with next file
            continue 2
        fi
    done
    # file is not yet in array -> add it
    a+=($f)
done

Revision: 21716
at December 18, 2009 23:02 by tm


Initial Code
shopt -s nocasematch; unset a
for f in *; do
    for e in "${a[@]}"; do
        if [[ "$f" == "$e" ]]; then
            echo "'$f' equivalent to "$e""
            continue 2
        fi
    done
    a+=($f)
done

Initial URL

                                

Initial Description

                                

Initial Title
Identify files in cwd which only differ in case

Initial Tags
Bash, files

Initial Language
Bash