title: Getting Bash error too many arguments while running bash script
body: <p>I am trying to write some logic based avro files available in a directory </p>
  
  <p>But I am getting too many arguments error .   </p>
  
  <pre><code> [cloudera@client01 scripts]$ hdfs dfs -ls /user/cloudera/output_files/file_date_2017-04-06
  
  Found 11 items
  -rw-rw----   2 cloudera cloudera          0 2017-04-24 13:57 /user/cloudera/output_files/file_date_2017-04-05/_SUCCESS
  -rw-rw----   2 cloudera cloudera     781714 2017-04-24 13:56 /user/cloudera/output_files/file_date_2017-04-05/part-r-00000-7e1d4e4e-9166-4744-b73b-095a7cc0e090.avro
  -rw-rw----   2 cloudera cloudera     782132 2017-04-24 13:56 /user/cloudera/output_files/file_date_2017-04-05/part-r-00001-7e1d4e4e-9166-4744-b73b-095a7cc0e090.avro
  -rw-rw----   2 cloudera cloudera     782467 2017-04-24 13:56 /user/cloudera/output_files/file_date_2017-04-05/part-r-00002-7e1d4e4e-9166-4744-b73b-095a7cc0e090.avro
  -rw-rw----   2 cloudera cloudera     785117 2017-04-24 13:56 /user/cloudera/output_files/file_date_2017-04-05/part-r-00003-7e1d4e4e-9166-4744-b73b-095a7cc0e090.avro
  </code></pre>
  
  <p>When I apply the below if condition I get below error.</p>
  
  <pre><code>[cloudera@client01 scripts]$ if [ hdfs dfs -test -e "/user/cloudera/output_files/file_date_2017-04-06/part*.avro" ];
  &gt; then
  &gt; echo "PASS"
  &gt;  else
  &gt; echo "FAIL"
  &gt;  fi
  -bash: [: too many arguments
  FAIL
  
  
  [cloudera@client01 scripts]$ if [ hdfs dfs -test -e /user/cloudera/output_files/file_date_2017-04-06/part*.avro ]; then   echo "PASS";  else echo "FAIL";  fi
  -bash: [: too many arguments
   FAIL
  [cloudera@client01 scripts]$
  </code></pre>
  
  <p>I dont know what went wrong in my if condition .
  Could someone help me to fix this error .</p>