![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting yesterday DATE | osymad | Shell Programming and Scripting | 16 | 06-06-2008 05:46 AM |
| Yesterday in i.e. May 09 and 05/09 format | Daniel Gate | Shell Programming and Scripting | 3 | 05-20-2008 01:59 PM |
| yesterday | Tlg13team | Shell Programming and Scripting | 0 | 02-27-2008 01:02 AM |
| How to show yesterday date | wind_n_cloud | Shell Programming and Scripting | 1 | 02-16-2005 07:51 PM |
| minor issue on question that i had posted !! | moxxx68 | Post Here to Contact Site Administrators and Moderators | 4 | 10-23-2004 01:51 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
1. Replace the [[ with the word "test" and get rid of the "]]"
2. Remove the trailing slash on the directory paths for the if/test 3. Remember UNIX file systems are case sensitive |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
Even though the trailing slash is theoretically irrelevant, it has caused me problems in the past where somehow "/a/b/c/" not equivilant to "/a/b/c".
I see no reason to replace the brackets with the "test" command. Is there a functional difference? I prefer the brackets for readability. |
|
#10
|
|||
|
|||
|
Personal choice, I like to see what is actually happening, ie, "if runs a program to determine which branch is executed".
|
|
#11
|
||||
|
||||
|
Quote:
It starts to become extremely important to know the difference when you use mv, if you include a trailing / on the desitnation path, it will fail if the dir does not exist. If you leave it off, it will rename the source to the name of the desitnation directory but only if it doesn't exist :/ |
|
#12
|
|||
|
|||
|
Quote:
I've made all the changes I get the same results. #!/usr/bin/bash bank=`cat /export/home/usr/banklist.txt` cdir=`cat /export/home/usr/mountlist.txt` for d in $cdir ;do for i in $bank ;do if [[ -d /apps/data/custdata/$d/$i/incoming ]] ; then ls -ltra /apps/data/custdata/$d/$i/incoming fi if [[ -d /apps/data/custdata/$d/$i/outgoing ]] ; then ls -ltra /apps/data/custdata/$d/$i/outgoing fi done done; Or #!/usr/bin/bash bank=`cat /export/home/usr/banklist.txt` cdir=`cat /export/home/usr/mountlist.txt` for d in $cdir ;do for i in $bank ;do if test -d /apps/data/custdata/$d/$i/incoming ; then ls -ltra /apps/data/custdata/$d/$i/incoming fi if test -d /apps/data/custdata/$d/$i/outgoing ; then ls -ltra /apps/data/custdata/$d/$i/outgoing fi done done; both get no output. Last edited by xgringo; 12-19-2007 at 01:23 PM. |
|
#13
|
||||
|
||||
|
So let's take a look at the new code then...
|
|
#14
|
|||
|
|||
|
And a fully qualified subset list of expected files....
|
|||
| Google The UNIX and Linux Forums |