Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I guess the best way would be to use augeas, which is a great tool. With augeas you can parse configuration files automatically, append/delete/update some field with XPATH, which is used to navigate through the XML.</p> <p>You can find all the supported conifiguration files that augeas can correctly parse in the following directory:</p> <pre><code>/usr/share/augeas/lenses/dist/ </code></pre> <p>One of the files is fstab.aug, which is the one you want. You don't actually need to do anything with that files, it's just there to let you know that augeas can do what you want :).</p> <pre><code># ls /usr/share/augeas/lenses/dist/fstab.aug /usr/share/augeas/lenses/dist/fstab.aug </code></pre> <p>You can also look here for more detailed example obout changing /etc/fstab through augeas.</p> <p><a href="http://mrpointy.wordpress.com/2010/05/01/augeas-and-appending-lines-to-etcfstab/" rel="nofollow">Augeas Example</a></p> <p>I guess you can use something like the following:</p> <pre><code># augtool augtool&gt; set /files/etc/fstab/1[file='/']/opt[1] "acl" augtool&gt; set /files/etc/fstab/1[file='/']/opt[2] "errors=remount-ro" augtool&gt; print /files/etc/fstab/1 /files/etc/fstab/1 /files/etc/fstab/1/spec = "/dev/mapper/system" /files/etc/fstab/1/file = "/" /files/etc/fstab/1/vfstype = "ext3" /files/etc/fstab/1/opt[1] = "acl" /files/etc/fstab/1/opt[2] = "errors=remount-ro" /files/etc/fstab/1/dump = "0" /files/etc/fstab/1/passno = "1" augtool&gt; save </code></pre> <p>If you want to use augeas in a shell script you can just preced the above commands with augtool keyword, so if you want to change the first 'opt' to 'acl' you would do: </p> <pre><code>augtool set /files/etc/fstab/1[file='/']/opt[1] "acl" augtool set /files/etc/fstab/1[file='/']/opt[2] "errors=remount-ro" augtool save </code></pre> <p>Look at the original augeas page for more: <a href="http://augeas.net" rel="nofollow">Augeas Homepage</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload