Can't use wildcards in shell script
質問
It is about 3 days I'm struggling with
D1="`ls $g???_???_?????$DATE1`"" ` |`""` wc -l`"
if [ $D1 -eq "0" ]
and still it ends with syntax error. The last syntax error bash tells is syntax error at line 1: `|' unexpected.
Can you please help me?
解決 2
This is what finally worked:
D1=`ls 'a_costant_string'"$DATE1"????????"$g"* | sort -u | wc -l`
I meantion it here because it took me lots of time to find the combination that work correctly and this was actually the correct answer.
他のヒント
I'm not sure what you want to achieve. However, the pipe symbol is part of a substitution command, and not a substitution command on it's own.
D1="`ls $g???_???_?????$DATE1 | wc -l`"
if [ $D1 -eq 0 ]; then
...
fi
所属していません StackOverflow