[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#181808: libc6: /etc/init.d/devpts incorrect use of grep



Package: libc6
Version: 2.3.1-11

The current /etc/init.d/devpts contains lines like:

devpts_avail=`grep -qci '[<[:space:]]devpts' /proc/filesystems || true`

But grep -qci never gives any output, it simply returns true (if a
line was found) or false (if not).  So this will always set
devpts_avail to empty, which isn't very useful.  Better ways of doing
this, while still always being true, would be:

devpts_avail=`grep -ci '[<[:space:]]devpts' /proc/filesystems || true`

(remove the -q option), or

devpts_avail=`grep -i '[<[:space:]]devpts' /proc/filesystems | wc -l`

(pipe to wc).  The latter has the possible advantage that if
/proc/filesystems is unavailable or something like that, set -e will
kill the script.

   Julian

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        Julian Gilbey, website: http://www.polya.uklinux.net/
   Debian GNU/Linux Developer, see: http://people.debian.org/~jdg/
     Visit http://www.thehungersite.com/ to help feed the hungry



Reply to: