Patrick O'Callaghan wrote: > Also the GRUB_DISTRIBUTOR line has a sed command using single quotes > within a double-quoted string. It could be done with all double quotes > and a lot of escaping, but this way is cleaner.
I'm not suggesting there's any reason to change things, but
just for what it's worth, it works equally well with double
quotes:
$ grep ^GRUB_DISTRIBUTOR= /etc/default/grub | tr "'" '"' | tee /tmp/grub
GRUB_DISTRIBUTOR="$(sed "s, release .*$,,g" /etc/system-release)"
$ (. /etc/default/grub; echo "GRUB_DISTRIBUTOR='$GRUB_DISTRIBUTOR'"; \
. /tmp/grub; echo "GRUB_DISTRIBUTOR='$GRUB_DISTRIBUTOR'")
GRUB_DISTRIBUTOR='Fedora'
GRUB_DISTRIBUTOR='Fedora'
The double quotes on the outside of the command substitution
don't necessitate the use of single quotes within. The main
argument for single quotes in the sed command, IMHO, is that
nothing in the argument should be expanded by the shell.
Having to even think about these things is a good reason to
try and avoid using config files which run shell commands
whenever possible though. ;)
--
Todd
signature.asc
Description: PGP signature
-- _______________________________________________ users mailing list -- [email protected] To unsubscribe send an email to [email protected] Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/[email protected] Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
