On Fri, Jul 28, 2017 at 07:22:16AM -0400, Robert P. J. Day wrote:
> OK, this exercise should be a bit trickier -- given a character MAC
> address, how can I break it into individual hex chars for writing to
> EEPROM? So the script takes the argument, say, "A0:B1:C2:D3:E4:F5",
> and I need to,
On 2017-07-28 09:06 AM, Stephen M. Webb wrote:
>
> You could also go for sed instead.
>
> $ for c in $(echo A0:B1:C2:D3:E4:F5 | sed
> 's/\([[:xdigit:]]\{2,2\}\)[^[:xdigit:]]*/ 0x\1/g'); do echo $c; done
> 0xA0
> 0xB1
> 0xC2
> 0xD3
> 0xE4
> 0xF5
>
> but the readability of that is questionable.
On 2017-07-28 07:22 AM, rpj...@crashcourse.ca wrote:
>
> OK, this exercise should be a bit trickier -- given a character MAC
> address, how can I break it into individual hex chars for writing to
> EEPROM? So the script takes the argument, say, "A0:B1:C2:D3:E4:F5",
> and I need to, one nibble
On 28/07/17 07:22 AM, rpj...@crashcourse.ca wrote:
>
> OK, this exercise should be a bit trickier -- given a character MAC
> address, how can I break it into individual hex chars for writing to
> EEPROM? So the script takes the argument, say, "A0:B1:C2:D3:E4:F5",
> and I need to, one nibble at
On 28/07/17 07:15 AM, rpj...@crashcourse.ca wrote:
>
> Curious about the best(?) way to do some simple operations in a shell
> script
> that I would *prefer* to be POSIX-compliant, so here's the first
> question --
> how to loop through the individual characters of a string?
>
> I just
Curious about the best(?) way to do some simple operations in a shell script
that I would *prefer* to be POSIX-compliant, so here's the first question --
how to loop through the individual characters of a string?
I just stumbled across this solution I'd never heard of:
$ echo "rday" |