【发布时间】:2017-08-21 14:32:41
【问题描述】:
我想在fstab 中添加一个条目,我在我的/bin/bash 脚本中使用了这个命令:
echo -n | tail -1 /mnt/etc/fstab | sed 's/\(-\).*/-03/' >> /mnt/etc/fstab
echo -e -n "\t" >> /mnt/etc/fstab
echo -n "/home" >> /mnt/etc/fstab
echo -e -n "\t" >> /mnt/etc/fstab
echo -n "ext4" >> /mnt/etc/fstab
echo -e -n "\t" >> /mnt/etc/fstab
echo -n "default,noatime" >> /mnt/etc/fstab
echo -e -n "\t" >> /mnt/etc/fstab
echo -n "0" >> /mnt/etc/fstab
echo -e -n "\t" >> /mnt/etc/fstab
echo "2" >> /mnt/etc/fstab
这是原文:
proc /proc proc defaults 0 0
PARTUUID=ee397c53-01 /boot vfat defaults 0 2
PARTUUID=ee397c53-02 / ext4 defaults,noatime 0 1
这是预期的输出:
proc /proc proc defaults 0 0
PARTUUID=ee397c53-01 /boot vfat defaults 0 2
PARTUUID=ee397c53-02 / ext4 defaults,noatime 0 1
PARTUUID=ee397c53-03 /home ext4 defaults,noatime 0 2
而是输出如下:
proc /proc proc defaults 0 0
PARTUUID=ee397c53-01 /boot vfat defaults 0 2
PARTUUID=ee397c53-02 / ext4 defaults,noatime 0 1
PARTUUID=ee397c53-03
/home ext4 default,noatime 0 2
管道出了什么问题?
【问题讨论】: