Question

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?

Was it helpful?

Solution 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.

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top