title: shell list All Xcode xcworkspace and xcodeproj
body: <p>I want to list project directory all xcworkspace and xcodeproj file.</p>
  <p>And I write code below</p>
  <pre class="lang-bash prettyprint-override"><code>#!/bin/bash
  
  workspaceFile=&quot;xcworkspace&quot;
  projectFile=&quot;xcodeproj&quot;
  
  #listFiles 
  path=$(pwd)
  
  fileList=()
  
  walk_dir () {
      for name in &quot;$path&quot;/*; do
          if [[ -d &quot;$name&quot; &amp;&amp; (&quot;${name##*.}&quot; != ${projectFile} || &quot;${name##*.}&quot; != ${workspaceFile}) ]]; then
              path=$name
              walk_dir &quot;$name&quot;
          else 
              if [ &quot;${name##*.}&quot;x = ${workspaceFile}x ] || [ &quot;${name##*.}&quot;x = ${projectFile}x ];then
                  fileList+=($name)
              fi
          fi
      done
  }
  
  walk_dir
  
  for name in ${fileList[@]}; do
      echo $name
  done
  </code></pre>
  <p>It did not work.</p>
  <p>But If change the condition, like below</p>
  <pre class="lang-bash prettyprint-override"><code>        if [[ -d &quot;$name&quot; &amp;&amp; (&quot;${name##*.}&quot; != ${workspaceFile}) ]]; then
              path=$name
              walk_dir &quot;$name&quot;
          else 
              if [ &quot;${name##*.}&quot;x = ${workspaceFile}x ] || [ &quot;${name##*.}&quot;x = ${projectFile}x ];then
                  fileList+=($name)
              fi
          fi
  </code></pre>
  <p>or</p>
  <pre class="lang-bash prettyprint-override"><code>        if [[ -d &quot;$name&quot; &amp;&amp; (&quot;${name##*.}&quot; != ${projectFile}) ]]; then
              path=$name
              walk_dir &quot;$name&quot;
          else 
              if [ &quot;${name##*.}&quot;x = ${workspaceFile}x ] || [ &quot;${name##*.}&quot;x = ${projectFile}x ];then
                  fileList+=($name)
              fi
          fi
  </code></pre>
  <p>It works also.</p>
  <p>I want to keep filter xcworkspace and xcodeproj.</p>
  <p>Someone can help me?</p>