1
給出一個配置文件,如sshd_config中:編輯線的配置文件從外殼
[...]
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication yes
X11Forwarding yes
X11DisplayOffset 10
[...]
我想編寫一個命令,讓我樹立了配置設置。例如,我想將PasswordAuthentication
設置爲no
。如果條目已經存在,我想替換它,如果不存在,我想將它添加到文件的末尾。
我該如何從shell中做到這一點?
你可能尋找['awk'](http://linux.die.net/man/1/awk )。 – 2012-07-30 12:09:47