Main Menu

KB#00611-Unix script to link lower case files to upper case files

Title:

Unix script to link lower case files to upper case files

Description:

The following Unix script demonstrates linking an uppercase version of a file to an existing lower case version. 

When you FTP data dictionary files from a DOS machine to a Unix machine, it's common for all of the files to be created in lower case on the Unix side. This can cause problems, as the ODBC Driver and TAOS expect the Data Dictionary files to be in upper case. The solution is to link the lower case files to upper case versions. This is accomplished by the following script. Note that the third line specifies only the files that end in .1, so that it will only link the Data Dictionary files. 

========================== 
#!/bin/sh 
d=`dirname $0` 
files=*.1 
for i in $files 
do 
ln $i `echo $i | tr "[a-z]" "[A-Z]"` 
done 
========================== 

Resolution:

A little piece of useful information on the [a-z] or [A-Z] is that you can use that convention in other Unix commands...if for example you want to 'more' all the upper case files in a directory as in: 

more [A-Z]* 

or you want to delete all the files that start with a, b or c : 

rm [a-c]* 

or even [2-4]* (any file that begins with 2,3 or 4) 
or even [2-4][6-7]* (any file that begins with 2,3 or 4 and has 6 or 7 as the second number) 



Last Modified: 03/30/2000 Product: Other Operating System: UNIX

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN Profile Visit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel