![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading a file and writing the file name to a param file. | thebeginer | UNIX for Advanced & Expert Users | 1 | 10-05-2007 04:38 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 05:25 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
help with file name
His may seem simple to many but I have no clue
Need some urgent help please How can I make this statement evaluate to true if the actual DataFile can have an extension of either .dat or .txt what I'm trying to say is my datafile could have a name like ABC_20070323_xyz.dat or ABC_20070323_xyz.txt now the trick is also in the if statement These for example are now valid ABC_20070323_xyz.dat.gz or ABC_20070323_xyz.dat.Z or ABC_20070323_xyz.txt notice the .txt file can also have the option of no compression ControlFileName=${ControlFile##*/}; DataFile="${SOURCE_DATA_PATH}/${ControlFileName%.*}.dat"; if [[ -f "${DataFile}" ]]; then X=1; # Do nothing elif [[ -f "${DataFile}.gz" ]]; then DataFile=${DataFile}.gz; elif [[ -f "${DataFile}.Z" ]]; then DataFile=${DataFile}.Z; else Log ERROR "Could not find data file for Data File=${DataFile} [or .dat.gz or .dat.Z]"; returnStatus=1; break; fi; |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|