Je veux ajouter une entrée dans fstab
et j'utilise cette commande dans mon script /bin/bash
:écho tuyauterie, la queue et sed conduit à la mauvaise sortie
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
c'est le contenu original:
proc /proc proc defaults 0 0
PARTUUID=ee397c53-01 /boot vfat defaults 0 2
PARTUUID=ee397c53-02/ ext4 defaults,noatime 0 1
et ceci est le résultat attendu:
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
au lieu de la sortie est le Follo aile:
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
Qu'est-ce qui ne va pas dans la tuyauterie?