[arch-projects] [PATCH] [mkinitcpio] init: Remove sed cmd usage
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/init b/init index 25a51eb..943fa9a 100644 --- a/init +++ b/init @@ -38,7 +38,7 @@ else fi if [ -n "${disablehooks}" ]; then - for d in $(echo "${disablehooks}" | sed 's|,| |g'); do + for d in ${disablehooks//,/ }; do eval "hook_${d}=disabled" done fi -- 1.7.7.3
On Tue, Nov 15, 2011 at 10:10:39PM -0300, Gerardo Exequiel Pozzi wrote:
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init b/init index 25a51eb..943fa9a 100644 --- a/init +++ b/init @@ -38,7 +38,7 @@ else fi
if [ -n "${disablehooks}" ]; then - for d in $(echo "${disablehooks}" | sed 's|,| |g'); do + for d in ${disablehooks//,/ }; do eval "hook_${d}=disabled" done fi -- 1.7.7.3
You can go one step further and rip out the -n test. A for list element for a for loop that only expands to whitespace has zero length as far as iteration is concerned. d
On 11/16/2011 10:33 AM, Dave Reisner wrote:
On Tue, Nov 15, 2011 at 10:10:39PM -0300, Gerardo Exequiel Pozzi wrote:
Signed-off-by: Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> --- init | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/init b/init index 25a51eb..943fa9a 100644 --- a/init +++ b/init @@ -38,7 +38,7 @@ else fi
if [ -n "${disablehooks}" ]; then - for d in $(echo "${disablehooks}" | sed 's|,| |g'); do + for d in ${disablehooks//,/ }; do eval "hook_${d}=disabled" done fi -- 1.7.7.3
You can go one step further and rip out the -n test. A for list element for a for loop that only expands to whitespace has zero length as far as iteration is concerned.
d True true!
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
participants (2)
-
Dave Reisner
-
Gerardo Exequiel Pozzi