Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2811

bash で繰り返し特定コマンドを実行させる

$
0
0

例: 大量のディレクトリ毎に個別に tar.gz に圧縮する

#!/bin/sh

# ディレクトリ名のリスト
array=(
"0000"
"0001"
"0002"
)

for i in ${array[@]}; do
    echo "start tar ${i}"
    tar -zcf ${i}.tgz ${i}
done

Viewing all articles
Browse latest Browse all 2811

Trending Articles