我想知道网络上所有设备的名称。我已经尝试过很多在网上找到的命令,但没有取得很大成功,但没有像我想要的那样工作。
基本上,当我输入我的路由器设置时,我可以获得连接到我的网络的设备的名称。我也可以在某些应用程序上获得它,所以我想它可以通过某种方式完成。
我想要通过命令行连接到我的 Wi-Fi 网络的所有设备的名称列表。
谢谢
pi@raspberrypi ~ $ nmap -sP 192.168.4.0/24
Starting Nmap 6.00 ( http://nmap.org ) at 2015-03-05 13:55 UTC
Nmap scan report for 192.168.4.1
Host is up (0.0055s latency).
Nmap scan report for 192.168.4.2
Host is up (0.42s latency).
Nmap scan report for 192.168.4.4
Host is up (0.045s latency).
Nmap scan report for 192.168.4.5
Host is up (0.47s latency).
Nmap scan report for 192.168.4.6
Host is up (0.0032s latency).
Nmap scan report for 192.168.4.7
Host is up …Run Code Online (Sandbox Code Playgroud) 我有这样的情况:
./
./myscript.sh
./arguments.txt
./test.sh
Run Code Online (Sandbox Code Playgroud)
在里面myscript.sh,我必须运行文件test.sh,将里面包含的参数传递给它arguments.txt。
myscript.sh是:
arguments=$(cat arguments.txt)
source test.sh $arguments
Run Code Online (Sandbox Code Playgroud)
如果arguments.txt最多包含一个参数,则此方法运行良好:
firstargument
Run Code Online (Sandbox Code Playgroud)
替换是:
++ source test.sh 'firstargument'
Run Code Online (Sandbox Code Playgroud)
但问题在于两个或多个参数。它这样做:
++ source test.sh 'firstargument secondargument'
Run Code Online (Sandbox Code Playgroud)
另外,我事先不知道里面的参数数量arguments.txt。可以有零个或多个。
我看到了这个问题Why does Ctrl-D (EOF) exit the shell?并想在第二个答案上尝试这个例子。所以我创建了一个文件并使用了 hexdump:
federico@home ~ $ cat > test.txt
prova
^C
federico@home ~ $ hexdump test.txt
0000000 7270 766f 0a61
0000006
Run Code Online (Sandbox Code Playgroud)
第二行最后有“6”,如果我尝试使用http://www.rapidtables.com/convert/number/hex-to-ascii.htm从十六进制解码为 ascii,我会得到一个奇怪的字母顺序. 为什么会发生这种情况?谢谢
bash ×1
hexdump ×1
kali-linux ×1
networking ×1
raspbian ×1
scripting ×1
shell-script ×1
wifi ×1