I had written a script for moving/Copying files to particular folder. I need to check the filenames and move to respective folders. I can read the filenamess but, checking the filename contains a string giving the error.
Here my script ::
for eachfile in *; do
echo "INSIDE"
echo $eachfile
if [ [ $eachfile = "CHPOE05"* ] ]; then
echo $eachfile
else
echo "invalid"
fi
done
Below is my error:
Uploading file IN PCS FOLDER
INSIDE
CHPOE0500001.txt
INCOK1IGT1.sh: line 44: [: too many arguments
invalid
INSIDE
CHPOE050i1001.txt
INCOK1IGT1.sh: line 44: [: too many arguments
删除[ [
和] ]
之间的空格似乎对我有用。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.