
Jerry Feldman writes:
I am trying to test to see if a file exsides but the extension changes all the time, ie
ab251455.001 ab251455.002
if I do a : if [ -e /var/max/spool/inbound/ab251455.* ] ; then run_command fi
the run_command never runs
That's strange. I tried with #!/bin/bash if [ -e ab123.* ] ; then echo "It exists" fi and it works perfectly. Is run_command in the path? You might be a bit better off using the for command. #!/bin/bash if [ -e /var/max/spool/inbound/ab251455.* ] ; then LIST=$(ls /var/max/spool/inbound/ab251455.*) for i in $LIST do runcommand $i done fi
This will allow you to issue your command on the individual file.
I cannot get it to work if there is a path in the test line otherwise this is perfect for something I need to do :) Sean