On Fri, Sep 08, 2017 at 04:25:55PM +0100, Tomasz Kłoczko wrote: > On 8 September 2017 at 14:10, David Sterba <dste...@suse.cz> wrote: > > On Fri, Sep 08, 2017 at 10:54:46AM +0200, Ulli Horlacher wrote: > > > How can I test if a subvolume is a snapshot? > > > > The inode number is 256 on a btrfs filesystem: > > > > if [ stat -f --format=%T $path = btrfs -a stat --format=%i $path = 256 ]; > > ... > > This oneliner shows how much really basic btrfs tools commands syntax > is broken by design :( > Looking on how so freakishly overcomplicated btrfs command syntax is > that command like above is completely unintuitive and unreadable
This is nothing to do with btrfs tooling. The two commands involved here are test (aka "[") and stat. > sometimes I'm really thinking about start rewrite btrfs-progs to make > btrfs basic tools syntax as similar as it is only possible to ZFS zfs, > zpool and zdb commands on using which in +90% cases you can guess how > necessary syntax must look like without looking on man pages. > > Any volunteers want to join to help implement something like this? > Maybe someone already started doing this? The main complaint that can be directed at the btrfs command is that its output is rarely machine-processable. It would therefore make sense to have a "--table" or "--structured" mode for output, which would be more trivially parsable by shell tools. Hugo. -- Hugo Mills | Ceci est un travail pour l'Australien. hugo@... carfax.org.uk | http://carfax.org.uk/ | PGP: E2AB1DE4 | Louison, Delicatessen
signature.asc
Description: Digital signature