/etc/init.d/sysctl contains the line for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do When I insert "echo "Checking $conf" on the line below it, I get the two lines of output: Checking /etc/sysctl.conf Checking /etc/sysctl.d/*.conf The wildcard doesn't seem to get expanded. Expansion doesn't seem to happen in the subsequent calls to sysctly. Changing the loop to: for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do results in expansion, though obviously not only over the conf files. An inner check using grep should accomplish that filtering. Alternatively, find could be used for the iteration. Reproducible: Always
indeed, which explains the merits of the line : if [ -r "$conf" ]; then when the /etc/sysctl.d directory contains no .conf file especially Perhaps would you want that to be used : shopt -s/-u nullglob but this is not the choice made
(In reply to Taahir Ahmed from comment #0) > /etc/init.d/sysctl contains the line > > for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do *snip* > Changing the loop to: > > for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do Where is the change? These two lines appear to be the same to me. Also, if you run the script in verbose mode by typing: /etc/init.d/sysctl --verbose start you should see that all of the conf files are processed. I am unable to reproduce this. If you have more information, please let me know. Thanks, William
I can no longer reproduce this issue either. I'm not sure what the issue was -- perhaps it was just a misunderstanding on my part. As for my suggested change, I mistyped it. I meant to put: for conf in /etc/sysctl.conf /etc/sysctl./* ; do