[xubuntu-users] Precise problem with file name case (in)sensitivity

MR ZenWiz mrzenwiz at gmail.com
Thu Aug 23 18:20:13 UTC 2012


I have a shell script I use to convert TIFFs into PDFs using tiffcp
and tiff2pdf.  Today I had occasion to use it with some interesting
results.

Here is the shell script:

#!/bin/bash

if [[ -z "$1" || "$1" == "-h" ]]; then
    echo "Usage: `basename $0` [-c <combined-tif>] {<file-name>|<file-base>}..."
    echo "    where <file-name> includes the '.tif' and <file-base> does not."
    exit 0
fi

if [[ "$1" == "-x" ]]; then
    shift
    set -x
fi

if [[ "$1" == "-c" ]]; then
    tgt=$2
    shift 2
    k=`basename $tgt .tif`
    if [[ $tgt == $k ]]; then	# add the "tif" suffix
        tgt="$k.tif"
    fi
    echo "tiffcp $* $tgt"
    tiffcp $* $tgt	# combine all the tifs into one
    set $tgt		# and change the parameters to just this one
fi

for i in $*; do
    j=`basename $i .tif`
    if [ $j = $i ]; then
        i="$i.tif"
    fi
    j="$j.pdf"
    echo "tiff2pdf $i > $j"
    tiff2pdf -z $i > $j
done

---

I had four TIFFs I wanted to combine into a single one and from there
into a single pdf, to I ran it thus:

tif2pdf -c NajC0823 najC0823?.tif

What it should have done is this: combine the najC0823?.tif files into
a single TIFF called NajC0823.tif, then convert that into
NajC0823.pdf.

However, what it did was convert NajC0823.tif into najC0823.pdf.  When
I try to rename the actual result file (with the first letter lower
cased) to the intended result name (with the first letter upper
cased), mv says the two names are the same file.

Since when do the commands, including bash and mv, if not others, not
allow/recognize.enforce case sensitivity in file names?  Or is it
something else?

MR




More information about the xubuntu-users mailing list