2015年4月26日 星期日

[Bash] For loop into folder and do some command


Cause I have multi git folder, but I want git push under every folder.
So I write a script to do routine job for me.

#!/bin/sh

folder=`ls -d */`

echo $folder

#!/bin/bash
for i in $( ls ); do
   echo item: $i
   cd $i
   bash -c "git push"
   cd -
done

Reference:

0 意見:

張貼留言