sh

curlで帯域制限する方法

sh

$ curl -w "speed_down:%{speed_download}\n" -v --limit-rate 1000 http://hoge.hoge/

エイリアスではなく標準のコマンドを使う方法

sh

$ which ls ls -alt $ \ls

ワンライナーでループ処理

シェルで1行で繰り返し処理をするならreadが便利。 以下はphpの構文チェックを一括で行う例 $ find . -name "*.php" | while read file; do php -l $file; done; No syntax errors detected in ./a.php No syntax errors detected in ./b.php No syntax err…

スペース区切りの文字列をユニークにする方法

sh

trを使うのが早くて便利 $ txt="a b c a c d e" $ echo $txt | tr ' ' '\n' | sort -n | uniq | tr '\n' ' ' a b c d e