2

In /etc/sysconfig/* scripts one can have ordinary name=value assignments, of course.

But these files are interpreted by . from a shell, aren't they? Are there any restrictions upon the shell language that can legitimately (i.e. in accordance with whatever rules there are for the operating system) and portably (i.e. across multiple operating systems) be used in them? Or can one use arbitrary (POSIX) shell language?

I am thinking of things like:

  • complex assignments: abc=/var/${logdir}
  • sourcing common "library" or "helper" scripts

This RedHat documentation and this OpenMandriva documentation go into great depth on the various individual options that can be set, but are mute on the actual fundamental format of these files.

(The equivalent to /etc/sysconfig on Debian is /etc/default, which does have rules about the format. Debian's Policy Manual requires that files in /etc/default "must contain only variable settings and comments in POSIX.1-2017 sh format". This question is about RedHat's /etc/sysconfig though.)

1

short: it depends

longer:

Redhat and Mageia/Mandriva use a symbolic link for /bin/sh to point to bash, so when those are scripts, you'll get bash acting like sh, or bash itself, depending on whether the sourcing script uses bash or "sh". There are both cases for both systems.

Not all of the files in /etc/sysconfig are scripts; some (such as /etc/sysconfig/partmon on my Mageia6 machine, or systat.ioconf on my CentOS 7) are just data. Something reads that, but it's not done by sourcing a script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.