![]() |
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 |
| Setting environment variable on a remote solaris machine using shell script | eamani_sun | Shell Programming and Scripting | 1 | 05-30-2008 10:05 PM |
| setting a global variable in script | arunkumar_mca | UNIX for Dummies Questions & Answers | 3 | 10-23-2007 07:46 AM |
| Variable setting help please | penfold | Shell Programming and Scripting | 16 | 03-25-2006 09:25 PM |
| Simply shell script question | frustrated1 | Shell Programming and Scripting | 8 | 07-03-2005 02:22 AM |
| Setting a variable | photh | UNIX for Dummies Questions & Answers | 2 | 01-08-2003 10:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Setting basename and dirname variable to simply script.
Hello all,
Can somebody explain to me how set up a basename and dirname variable to simplify this script. I currently have a 'infile' with the contents of FTTPDataPVC_ & BaaisDSLFeed. I need to add a basename and or dirname variable so that any additions can be made through the infile and not really have to modify the script itself. I'm kinda in a crunch, so your help is greatly appreciated. If you can offer any suggestions on how to make this work or a better solution in handling the script will really help. #Here is my script alertUser="johndoe@yahoo.com" now=`date '+%m%d%y'`.txt now2=`date '+%m%d%Y'`.txt #BAAIS_MAIL=/apps/opt/tmp/baaisMFile for i in `cat /apps/opt/tmp/baaisFile` do file=$(echo "${i}$now" | grep 'FTTPDataPVC_') file2=$(echo ${i}$now2 | grep 'BaaisDSLFeed.') if [[ -f /apps/opt/Batch/inbox/"${file}" ]] || [[ -f /apps/opt/BatchFeed/inbox/"${file2}" ]] then echo "${file} ${file2} file found" else echo "${file} ${file2} not found\c Please contact Production Support" >> /apps/opt/tmp/baaisMFile fi done cat "/apps/opt/tmp/baaisMFile" | mailx -s "Alert: $(hostname) Baais File not Found" $alertUser #rm -r /apps/opt/tmp/baaisMFile Thanks, AC |
|
||||
|
Quote:
2. Personally I have all variables upper-case to make them obvious. 3. Try.. Code:
DIRNAME=`dirname $SOMEFILE` BASENAME=`basename $SOMEFILE` echo $BASENAME is in $DIRNAME |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|