Dev/Linux

여러 파일에 대해 같은 명령구 실행하기

공대나왔음 2015. 8. 25. 21:17


현재 폴더에 다수의 *.pairs 파일과 FastCommunityMH라는 실행파일이 존재할 때, 다음과 같은 shell script로 여러 파일에 대해 같은 명령을 처리할 수 있다.

$ for file in *.pairs; do ./FastCommunityMH -f "$file"; done


Reference
  • In the terminal, how can I repeat a command multiple times on different files? - Ask Ubuntu