I am trying to adapt the loop code from bash to csh:
while read file; do
if ! UPLOAD_FILE=$(ls "$UPLOAD_ARCHIVE_DIR"/*$file* 2>/dev/null); then
echo "could not find $file"
(( MISSING_COUNTER++ ))
continue
fi
ls -l "$UPLOAD_FILE" | sed 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'
cp "$UPLOAD_FILE" "$PROCESS_FILES_DIR"
DOS_FILE=$(basename "$UPLOAD_FILE")
SOR_FILE=$(echo $DOS_FILE | sed 's/.dat/.sor/')
unix2dos "$PROCESS_FILES_DIR"/"$DOS_FILE" 1>/dev/null 2>&1
mv "$PROCESS_FILES_DIR"/"$DOS_FILE" "$UPLOAD_PROCESS_DIR"
(( FOUND_COUNTER++ ))
done < "$1"
The input information comes from variable $input and contains a list, here is a sample record from the list: PL000000002002638908
So far, I have tried to use foreach and while loops without success, any help is greatly appreciate it!