cat $FILE | while read $i ; do if [ "$THECMD" != "" ] ; then Exec "$THECMD $i" echo "$i" fi done so in this script, no way to get THECMD passed into while. Please update the code to let WHILE remember all variables Thanks a lot for your support Best regards