[laptop-mode] [PATCH] POSIX complaint head

Bart Samwel bart at samwel.tk
Mon Jul 14 08:29:56 CEST 2008


Hi Alon,

Thanks, patch accepted! I wish there was a way to test this stuff for
POSIX compliance -- I already have a hard time keeping it bashism free. :-/

Cheers,
Bart

Alon Bar-Lev wrote:
> POSIX complaint head.
> 
> ---
> 
> --- a/usr/sbin/lm-profiler	2008-06-22 17:33:50.000000000 +0300
> +++ b/usr/sbin/lm-profiler	2008-07-05 01:32:22.000000000 +0300
> @@ -168,9 +168,9 @@ findinit(){
>  		INITDIR=/etc/rc.d/init.d
>  	fi
>  	if [ "$INITDIR" != "" ] ; then
> -		INIT=`ls $INITDIR/ |grep ^$1$ |head -1`
> +		INIT=`ls $INITDIR/ |grep ^$1$ |head -n 1`
>  		if [ -z "$INIT" ]; then
> -			INIT=`grep $1 $INITDIR/* |sed s/:.*// |head -1`
> +			INIT=`grep $1 $INITDIR/* |sed s/:.*// |head -n 1`
>  		else
>  			INIT="$INITDIR/$INIT"
>  		fi
> _______________________________________________
> laptop-mode mailing list
> laptop-mode at mailman.samwel.tk
> http://mailman.samwel.tk/mailman/listinfo/laptop-mode



More information about the laptop-mode mailing list