Reputation: 729
What is the error in that?
j=0
filenames=("")
filedates=("")
while read line
do
filenames[$j]="$line"
filedates[$j]=$(stat -c %y ${filenames[$j]} | cut -d ' ' -f1)
(( j++ ))
done < <(ls -t *.gz)
Out:
script.sh: line 9: syntax error near unexpected token `<'
script.sh: line 9: `done < <(ls -t *.gz)'
Really i don't know the error in that while loop, i tested it on several machine but same problem
Upvotes: 0
Views: 91
Reputation: 123500
The problem is that you're using bash
specific <(process substition)
, but running your script with /bin/sh
.
Use bash script.sh
instead of sh script.sh
, and make sure the shebang uses bash and not sh.
Upvotes: 2