Hi all;

I have just recently delved into the magical world of Bash scripting and programmed up the following script(not finished). The object is to parse the Path and check for the existence of each directory. Please don't send back an Awk or Sed statement that is more efficient. I am having enough trouble with the Bash script.

Something is wrong with the logic of the if-fi statement. It is triggered every time through the loop. The statement A="0;  " seems to be true no matter what the value of A. The if statement is there to clear out the first item in the array that seems to be empty. Please help.

#!/bin/bash
set -x
#trap read debug

Path="/Test/gary/run/something"
IFS=/
read -a Array <<< $Path


for i  in "${!Array[@]}"
do

        A="${i} ; ${Array[i]}" #Load A
        echo "A is equal to $A"
        if [ A="0 ; " ]
        then
                echo "continuing"
                continue
        else
                echo "Do rest of loop"
        fi

done

Thanks in advance.

Gary R.

Reply via email to