linux - shell命令求解
本文介绍了linux - shell命令求解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
先贴命令
cat >> /etc/ssh/sshd_config << 'EOF'
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
EOF
cat我知道是查看文件的意思,可是这条>> 和 << 是什么意思呢,求教
还有一句:
/bin/sed -i 's/#Banner/Banner/' /etc/ssh/sshd_config
求解命令
解决方案
第一条命令:cat >> /etc/ssh/sshd_config << 'EOF'
>> filename
:标准输出重定向,在此处意思是将标准输出重定向到写入到后面的filename
(默认是直接输出到终端),和>
不同的是,会seed
到文件结束位置,再写入,相当于append
文件。<< token inputs
:标准输入重定向,意思加后面的inputs
重定向为标准输入,直到匹配到token
结束。
表达能力有限,直接看下面吧
< file means open a file for reading and associate with STDIN.
<< token Means use the current input stream as STDIN for the program until token is seen. We will ignore this one until we get to scripting.
> file means open a file for writing and truncate it and associate it with STDOUT.
>> file means open a file for writing and seek to the end and associate it with STDOUT. This is how you append to a file using a redirect.
n>&m means redirect FD n to the same places as FD m. Eg, 2>&1 means send STDERR to the same place that STDOUT is going to.
第二条命令:/bin/sed -i 's/#Banner/Banner/' /etc/ssh/sshd_config
sed -i 's/search/replace' file
:在文件file
,搜索到search
替换为replace
。
这篇关于linux - shell命令求解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文