Quote:
Originally Posted by
Smiling Dragon
It's not irrelevant, just different. The test says "is the following entry a directory?" Putting a trailing slash says "Don't match unless this is a directory" it's redundant.
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 :/
''
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.