This script has ambiguous redirect error.
PHP Code:
...
cd $HOME
cd folder/work
# search all subfolders in work directory
find -mindepth 1 -maxdepth 1 -type d | while read directory
do
CUR_FOLDER="${directory#"./"}"
cd $CUR_FOLDER
chmod 644 *
for ff in *; do
if [ ! "$ff" = "body.txt" ]; then
FILE_NAME=`echo $ff | awk 'BEGIN{FS="."}{print $1}'` #filename
FILE_EXT=`echo $ff | awk -F"." '{print $NF}'` #file_ext
NEW_TXT_NAME=$FILE_NAME.txt
NEW_XML_FILE=$FILE_NAME.xml
echo $FILE_NAME $FILE_EXT $NEW_TXT_NAME $NEW_XML_FILE
echo "111" >> $NEW_TXT_NAME
echo "222" >> $NEW_XML_NAME
fi
done
cd $HOME
cd folder/work
done
...
like it:
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
AB023095 PDF AB023095.txt AB023095.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
Header Header Header.txt Header.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
0001 txt 0001.txt 0001.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
AB023069 PDF AB023069.txt AB023069.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
Header Header Header.txt Header.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
0001 txt 0001.txt 0001.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
AB023087 PDF AB023087.txt AB023087.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
Header Header Header.txt Header.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
0001 txt 0001.txt 0001.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
Header Header Header.txt Header.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
Scan_201104201130 pdf Scan_201104201130.txt Scan_201104201130.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
0001 txt 0001.txt 0001.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
BAN 19-04-11 #2 pdf BAN 19-04-11 #2.txt BAN 19-04-11 #2.xml
./get_mails: line 36: $NEW_TXT_NAME: ambiguous redirect
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
Header Header Header.txt Header.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
0001 txt 0001.txt 0001.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
BAN 19-04-11 pdf BAN 19-04-11.txt BAN 19-04-11.xml
./get_mails: line 36: $NEW_TXT_NAME: ambiguous redirect
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
Header Header Header.txt Header.xml
./get_mails: line 37: $NEW_XML_NAME: ambiguous redirect
please, tell me what wrong with this script?