The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-24-2008
msb65 msb65 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 89
Check if file is directory (-d) using case sensitive

Hi,

I am writing a bash script. At the beginning of the script there is a user defined variable which is a directory in which processed data will be moved. When running the script I would like to immediately make sure that the directory exists, and if not the script will error. The following code should do that:

OUTDIR='/Users/msb65/test_data'

if [ -d $OUT_DIR ]; then
echo '- OUT_DIR exists'
else
echo; echo; echo 'ERROR: OUT_DIR does not exist'
exit 1
fi

However, this test does NOT seem to be case sensitive. How can I make it so it is? Thanks.

Mike