使用echo写入单行内容
[root@redis-01 kubernetes]# echo "ETCD_DATA_DIR=/var/lib/etcd">test.conf [root@redis-01 kubernetes]# cat test.conf ETCD_DATA_DIR=/var/lib/etcd
单行内容追加
[root@redis-01 kubernetes]# echo "ETCD_NAME=etcd-test">>test.conf [root@redis-01 kubernetes]# cat test.conf ETCD_DATA_DIR=/var/lib/etcd ETCD_NAME=etcd-test
多行内容写入
[root@redis-01 kubernetes]# cat >test.conf<<EOF > ETCD_DATA_DIR_=/var/lib/etcd > EOF [root@redis-01 kubernetes]# cat test.conf ETCD_DATA_DIR_=/var/lib/etcd
多行内容追加
[root@redis-01 kubernetes]# cat>>test.conf <<EOF > ETCD_NAME=etcd-test > EOF [root@redis-01 kubernetes]# cat test.conf ETCD_DATA_DIR_=/var/lib/etcd ETCD_NAME=etcd-test