使用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