led_ctrl: set IFS in POSIX shell way v0.2
authorSimon Guinot <simon@sequanux.org>
Tue, 9 Nov 2010 15:31:56 +0000 (16:31 +0100)
committerSimon Guinot <simon@sequanux.org>
Tue, 9 Nov 2010 17:02:45 +0000 (18:02 +0100)
led_ctrl/led_ctrl

index db43379..7987ab5 100755 (executable)
@@ -43,7 +43,9 @@ set_led_attr() # <led> <attribute> <value>
        local attr err=0
 
        IFS_ORIG="$IFS"
-       IFS=$'\n'
+       # Note that '\t' is added to prevent a standard POSIX shell
+       # from removing the trailing newline characters.
+       IFS=$(printf '\n\t')
 
        for attr in $(ls -1 $SYSPATH/$1/$2); do
                log_and_exec "echo $3 > \"$attr\"" || { err=1; break; }