How (or why) does this bash script snippet work?

Dean S. Messing deanm at sharplabs.com
Thu Jan 12 19:02:50 UTC 2012


In a system script I find this snippet

  nodevs=$(< /proc/filesystems fgrep rootfs)

and don't understand the syntax.  According to the bash man page,

$(< file) is shorthand for $(cat file).  But then the above should read

  nodevs=$(< /proc/filesystems | fgrep rootfs)

However, the latter leaves $nodevs empty whereas the former puts the
stuff that fgrep processes into nodevs as it should.


More information about the users mailing list