LoginSignup
2
0

More than 5 years have passed since last update.

fish shellで `echo {0..255}` は `seq` を使う

Posted at

ただの備忘録。

何やりたかったの?

LAN内で使われているIPアドレスを調べる6つの方法(Linux/Windows) | 俺的備忘録 〜なんかいろいろ〜

$ echo 192.168.0.{1..254} | xargs -P256 -n1 ping -s1 -c1 -W1 | grep ttl

つまり

192.168.0.x に所属する IPアドレスにpingを送り、返答の合ったものを一覧表示する。

これをするに辺り、 {1..254} の展開ができず、 ping: cannot resolve 192.168.1.{1..254}: Unknown host と怒られてた。

どう書くの?

こうでした。

$ echo 192.168.1.(seq 1 254) | xargs -P256 -n1 ping -s1 -c1 -W1 | grep ttl

参考資料

別の解法

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0