Search code examples
bashshellwildcardls

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?


Solution

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