如何使用 shell 回显新行?

问题描述 投票:0回答:1

使用此代码,它将其添加到最后一行,这使得我的 fstab 无法解析。我怎样才能强制它使用新行?

echo -e "/dev/disk/by-uuid/eab3b3c5-7473-4308-bf3a-633def59c06c /mnt/storage auto nosuid,nodev,nofail,x-gvfs-show 0 0" | sudo tee -a /etc/fstab
linux bash shell
1个回答
0
投票

尝试:

echo -e "\n/dev/disk/by-uuid/eab3b3c5-7473-4308-bf3a-633def59c06c /mnt/storage auto nosuid,nodev,nofail,x-gvfs-show 0 0" >> /etc/fstab

换句话说:

  1. 我在新行之前添加了
    \n
  2. 我将
    echo
    输出附加到
    /etc/fstab
    ,该输出将在没有新行的情况下终止。
© www.soinside.com 2019 - 2024. All rights reserved.