/etc/fstab
ファイルに次の行があります
/dev/mapper/vg_D /data/container xfs defaults 0 0
しかし、行を次のように一致させようとすると
LINE=/data/container
grep -qxF "$LINE" /etc/fstab || echo "line not in file !!!"
line not in line !!!
grep -qxF
ラインが合わないと思います。 /data/container
私たちはどこで間違っていますか?そして行を一致させる方法は何ですか?
ベストアンサー1
このパラメータを使用しないでください-x
。行全体を一致させようとします。
-x, --line-regexp
Select only those matches that exactly match the whole line. For a regular expression
pattern, this is like parenthesizing the pattern and then surrounding it with ^ and $.
/data/container
したがって、他の内容が含まれていない行のみが一致します。