:: Re: [DNG] Wifi device names: was sy…
トップ ページ
このメッセージを削除
このメッセージに返信
著者: Didier Kryn
日付:  
To: dng
題目: Re: [DNG] Wifi device names: was systemd is haunting me
Le 31/01/2016 03:12, Steve Litt a écrit :
> #!/bin/sh
> if test "$#" == "0"; then
>    lineno="1"
> else
>    lineno=$1
> fi

>
> ip link | \
>    cut -d ' ' -f2 | \
>    grep ^w | \
>    sed -e "s/:\s*$//" | \
>    head -n $lineno | \
>    tail -n 1


     Doesn't work out of the box.


     If /usr/bin/test was invoqued you should write '-eq' instead of 
'=='. But shell languages have non-standard built-ins. If /bin/sh points 
to dash, like in Debian, then the built-in test would accept '='. I 
guess '==' is a bashism (actually the adoption of a Cism by a shell 
language). Replacing '==' by '=' just works.


     Thanks for the script nevertheless :-)


     Didier