我正在使用bash来获取该脚本的机器的IP地址:
_MyGW="$( ip route get 8.8.8.8 | awk 'N=3 {print $N}' )"
Run Code Online (Sandbox Code Playgroud)
现在我想尝试这种类型的子网掩码:
192.168.1.0/24
Run Code Online (Sandbox Code Playgroud)
但我不知道我该怎么做.
我使用的是Debian 7.4 Wheezy.我试图升级我的内核,但当我输入"make menuconfig"时它说:
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2
Run Code Online (Sandbox Code Playgroud)
我试图安装"libncurses5-dev",但是我得到了错误:
E: Unable to locate package libncurses5-dev
Run Code Online (Sandbox Code Playgroud)
PS
我手动下载并安装了软件包,现在一切正常!非常感谢!!
当我尝试使用命令make-kpkg在Debian 7.4上编译内核3.14时:
/usr/bin/fakeroot: line 178: make-kpkg: command not found
Run Code Online (Sandbox Code Playgroud)
我想知道我可以在没有编译的情况下安装内核吗?
我想在 CentOS 在 init 3 中启动时向我显示我的 ip 地址,然后再登录。例如:
CentOS Realese 6.5(Final)
Kernel 2.6..
ip addr: 192.168.1.1
Run Code Online (Sandbox Code Playgroud)
或类似的东西。
我制作的脚本是:
#!/bin/bash
ifconfig eth0 | grep 'inet addr'
Run Code Online (Sandbox Code Playgroud)
但是,我不知道我把它放在哪里。
我在 rc.local 中尝试(使用“cat”和他的路径)但显然它不是正确的地方,或者我做错了什么。我在 /etc/issue 中尝试,但也许我做错了什么。
我试图以这种方式使用 bash 获取网络掩码:
192.168.1.0/x
Run Code Online (Sandbox Code Playgroud)
我试过:
ip -o -f inet addr show | awk '/scope global/ {print $4}'
Run Code Online (Sandbox Code Playgroud)
但输出是:
192.168.1.123/x
Run Code Online (Sandbox Code Playgroud)
所以这种方式对我不起作用。
我有一个bash脚本,但它给了我恼人的输出,我不想看到.当然我可以用这种方式隐藏它:
./script.sh >/dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)
但是我想把脚本放在"rc.local"或"cron job"中,所以如果它每隔5分钟接收一次输出,或者在启动时就会非常糟糕.如果有一种方法可以告诉整个脚本隐藏输出,那将会很棒.