title: Creating an array of files in a subfolder
body: <p>I'm trying to write a bash script for a homework question where I need to access some files in a source folder, remove all comments from them and send the uncommented files (or a copy) to a destination folder, here's my current attempt:</p>
  
  <pre><code>#!/bin/bash
  destination="$1"
  source="$2"
  mkdir "$destination"
  files=(${$("$source"/*)})
  for file in "${files[@]}" 
  do  
      grep -E -v "^[[:space:]]*[//]" "$file"&gt;&gt; "/$destination/$file"
  done
  </code></pre>
  
  <p>The problem seems to be I'm not creating the array elements correctly, I want the array to contain the names of the files in the source folder, can anyone direct me to the correct way of doing that (preferably without solving the whole exercise as it is homework after all)/</p>