I use Bash 4.3.48(1) in Ubuntu 16.04 (xenial) with a LEMP stack.
I try to create a php.ini overridings file in a version agnostic way with printf.
1) The version agnostic operation fails:
printf "[PHP]\n post_max_size = 200M\n upload_max_filesize = 200M\n cgi.fix_pathinfo = 0" > /etc/php/*/fpm/zz_overrides.ini The following error is given:
bash: /etc/php/*/zz_overrides.ini: No such file or directory
2) The version gnostic operation succeeds:
printf "[PHP]\n post_max_size = 200M\n upload_max_filesize = 200M\n cgi.fix_pathinfo = 0" > /etc/php/7.0/fpm/zz_overrides.ini As you can see, both are basically identical besides * vs 7.0.
- I didn't find a clue about this (regex?) problem in
man printf. - I searched in Google and found nothing about "allowing regex in printf".
Why does the version agnostic operation fails and is there any bypass?
Edit: If possible, it is most important for me to use a one-line operation.