I have a file with some lines in it:
/snapshot/200
/snapshot/201
/snapshot/202
Now i'm trying to use each line with a while IFS loop to do certain actions with them.
while IFS=' ' read -r test || [ -n "${test}" ];
do
if ssh root@$TARGET "[ ! -d $test ]"
then
echo "${test}"
fi
done < $filelist
The problem here I only get one result and it's not looping through the whole file? The if statement should be correct, since there are no directories with these names.
If however i remove the entire if part and just use
echo "${test}"
the loop works.