Web lists-archives.com

Re: OT: Current_Pending_Sector on /dev/sd?




> > ./check_smart.pl -g /dev/sd[a-z] -i ata
> > OK: [/dev/sda] - Device is clean|

> you have to use double-quotes because it's a regular expression within the
> perl plugin:
> 
> ./check_smart -g "/dev/sd[a-z]" -i ata

At the shell level, it's a glob which happens to match one or more
device nodes.  So you're quoting the glob to prevent the shell from
performing filename expansion.

Without the quotes, the glob is expanded, and you end up running a
command like:

./check_smart.pl -g /dev/sda /dev/sdb /dev/sdc -i ata

which doesn't do what you expected.

With the quotes, the glob is passed verbatim to the perl script, and
the perl script does whatever it has been programmed to do with it.

There's precedent for this behavior in a few other unix commands, like
find and tar, both of which can take (quoted) globs as arguments
and perform their own matching and/or expansion against them.