我想在fstab
添加一个条目,我在我的/bin/bash
脚本中使用这个命令:管道呼应,尾部和SED导致错误输出
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
管道有什么问题?