title: running for loop in bash
body: <p>I'm trying to get the below to take usernames from the 'users' file identified and for each line, (cd ~$user) and check for a .subscriptions file, if there, less that output into a file under data.</p>
  
  <pre><code> #!/bin/bash
    2 
    3 
    4 
    5 data=/usr2/c/subscription/userdata
    6 users=`cat /usr2/c/subscription/users`
    7 
    8 for i in $users
    9 do
   10 cd ~$i
   11 if 
   12         (test .subscriptions)
   13 then
   14         less .subscriptions &gt;&gt; $data
   15 else 
   16         echo "didn't run"
   17 fi
   18 done
  </code></pre>