1 |
On 12 Apr 2017 11:43, Christos Kotsi wrote: |
2 |
> # Tweak the livecd make.conf so that users know not to edit it |
3 |
> # https://bugs.gentoo.org/144647 |
4 |
> -mv ${clst_make_conf} ${clst_make_conf}.old |
5 |
> -echo "####################################################" >> ${clst_make_conf} |
6 |
> -echo "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##" >> ${clst_make_conf} |
7 |
> -echo "## PLEASE EDIT /mnt/gentoo${clst_make_conf} INSTEAD ##" >> ${clst_make_conf} |
8 |
> -echo "####################################################" >> ${clst_make_conf} |
9 |
> -cat ${clst_make_conf}.old >> ${clst_make_conf} |
10 |
> - |
11 |
> +echo -e "####################################################\n$(cat ${clst_make_conf})" > ${clst_make_conf} |
12 |
> +echo -e "## PLEASE EDIT /mnt/gentoo${clst_make_conf} INSTEAD ##\n$(cat ${clst_make_conf})" > ${clst_make_conf} |
13 |
> +echo -e "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##\n$(cat ${clst_make_conf})" > ${clst_make_conf} |
14 |
> +echo -e "####################################################\n$(cat ${clst_make_conf})" > ${clst_make_conf} |
15 |
|
16 |
this is not an improvement: |
17 |
- the constant cat at the end is ugly |
18 |
- use of `echo -e` is discouraged |
19 |
- you've incorrectly changed some things to tabs |
20 |
|
21 |
you could write it instead: |
22 |
old_conf=$(cat "${clst_make_conf}") |
23 |
( |
24 |
echo ...all... |
25 |
echo ...the... |
26 |
echo ...things... |
27 |
echo "${old_conf}" |
28 |
) > "${clst_make_conf}" |
29 |
-mike |