[英]How to keep blank lines in the end of a file when I user cat command in shell script
[英]How to create a file with cat command and content, inside a shell script?
我想創建一個Shell腳本,一個接一個地執行以下內容嗎?
以下是我的腳本中的一些命令,其中包含使用cat命令創建的文件,如何將這些命令依次添加到shell腳本中以一個接一個地執行,
apt-get install -y docker.io
cat << EOF > /etc/docker/daemon.json
> {
> "exec-opts": ["native.cgroupdriver=systemd"]
> }
> EOF
apt-get install -y kubelet kubeadm Kubectl
為什么使用cat而不直接回顯到文件?
#!/bash/bin
apt-get install -y docker.io
echo "\n{\n\"exec-opts\": [\"native.cgroupdriver=systemd\"]\n}" >> /etc/docker/daemon.json
apt-get install -y kubelet kubeadm Kubectl
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.