DJanGo wrote:
>
>
> >
Code:
--------------------
> > bitrate=$(printf "CA:FE:04:DJ:AN:GO status 0 1 tags:r \nexit\n"|nc
127.0.0.1 9090|sed 's/%3A/:/g')|echo ${bitrate##*:}
--------------------
> >
> /QUOTE]
>
> These are really two separate commands on one line; nothing is being
> piped to the final echo command.
> Also, with a pipe, the last part doesn't have to wait for the first
> part to complete. It will likely give you an old value of bitrate,
> which looks fine when testing if the bitrate is not changing, but
> could surprise you later. Hence my suggestion would be:
>
> >
Code:
--------------------
> > bitrate=$(printf "CA:FE:04:DJ:AN:GO status 0 1 tags:r \nexit\n"|nc
127.0.0.1 9090|sed 's/%3A/:/g') && echo ${bitrate##*:}
--------------------
> >
>
> You want to make sure you're using an updated variable from the first
> part before extracting the bit rate with the second part, hence
> conditional execution (&&) is probably a bit better than a semicolon
> in this context.
----------------------
"Dreamer, easy in the chair that really fits you..."
------------------------------------------------------------------------
dsdreamer's Profile: http://forums.slimdevices.com/member.php?userid=12588
View this thread: http://forums.slimdevices.com/showthread.php?t=104646
_______________________________________________
diy mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/diy