我有几个 Ubuntu Server 16 安装,其中 NIC 使用interface:X
/etc/network/interfaces 文件中的语法获取静态地址和 dhcp 地址。
auto eno1
iface eno1 inet static
address 172.16.12.18
netmask 255.255.252.0
network 172.16.12.0
broadcast 172.16.15.255
gateway 172.16.12.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 172.16.0.3 172.16.8.7 8.8.8.8
auto eno1:1
iface eno1:1 inet static
address 172.16.13.18
netmask 255.255.252.0
network 172.16.12.0
broadcast 172.16.15.255
gateway 172.16.12.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 172.16.0.3 172.16.8.7 8.8.8.8
auto eno1:0
iface eno1:0 inet dhcp …
Run Code Online (Sandbox Code Playgroud) 我有一个名为“als”的脚本,用于解析用户.bashrc
文件中的别名,我想为通过 SSH 登录的任何用户运行该文件。
这应该显示类似于每日消息 (MOTD) 横幅。不过,MOTD 横幅是静态数据。
这是代码。
#!/bin/bash
echo
echo Your aliases:
echo \(from ~/.bashrc\)
echo
cat .bashrc | egrep 'alias.+\=' | tr -s [:space:] | sed 's_^ alias_alias_' | sed 's_alias__' | sort | sed 's_=_\t\t_' | sed 's_^ __'
Run Code Online (Sandbox Code Playgroud)
如果我将 ./als 附加到我的~/.profile
文件中,它会起作用,但这仅对我执行。同样,我希望在 shell 登录时为所有用户运行