Package: ntp Version: 1:4.2.6.p5+dfsg-7+deb8u1 Followup-For: Bug #749761
Further to my original report of nearly TWO YEARS AGO, the extractions of statsdir can be simplified with just the use of sed without the unecessary and wasteful use of cat or grep, and take account of any leading whitespace (tabs or spaces), using statsdir=$(sed -nr 's|^[[:space:]]*[^#]*statsdir[[:space:]]*||p' /etc/ntp.conf) If trailing white space should be trimmed (along with any following text eg an inline comment) and assuming the directory name does not contain spaces [this is not Windoze], then statsdir=$(sed -nr 's|^[[:space:]]*[^#]*statsdir[[:space:]]*([^[:space:]]*).*|\1|p') The expression successfully retrieves the three uncommented instances of the statsdir value from a file containing multiple spaces and spaces #statsdir no_space_before_hash_and_no_space_after # statsdir no_space_before_hash_and_space_after # statsdir no_space_before_hash_and_two_spaces_eafter # statsdir no_space_before_hash_and_two_tabs_eafter #statsdir space_before_hash_and_no_space_after_hash # statsdir space_before_hash_and_space_after_hash # statsdir tab_before_hash_and_space_after_hash # statsdir tab_before_hash_and_tab_after_hash statsdir specifier_has_no_leading_space_1 statsdir specifer_with_leading_space_2 statsdir specifer_with_leading_space_3 # This is a comment Why invoke cat and grep uncessarily when using sed alone will get the job done? -- System Information: Debian Release: 8.3 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: armhf (armv7l) Kernel: Linux 3.10.17.1-wand-armhf.com (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) Versions of packages ntp depends on: ii adduser 3.113+nmu3 ii dpkg 1.17.26 ii libc6 2.19-18+deb8u3 ii libcap2 1:2.24-8 ii libedit2 3.1-20140620-2 ii libopts25 1:5.18.4-3 ii libssl1.0.0 1.0.1k-3+deb8u4 ii lsb-base 4.1+Debian13+nmu1 ii netbase 5.3 Versions of packages ntp recommends: ii perl 5.20.2-3+deb8u4 Versions of packages ntp suggests: ii ntp-doc 1:4.2.6.p5+dfsg-7+deb8u1 -- Configuration Files: /etc/default/ntp changed [not included] /etc/ntp.conf changed [not included] -- no debconf information