I'm in the middle of writing a config tool for a bluetooth application on Raspberry Pi with Stretch Lite.
When I run hcitool scan
I see this output:
Scanning ...
00:80:52:51:3D:7E BlueCN+001 D-513D7E
84:C7:EA:64:45:87 Xperia X Compact
Now I want this output in a variable scanres
, so I use
scanres=$(hcitool scan)
This is seems OK, but the mac-address misses the ':'
echo $scanres
Scanning ...
00 80 25 51 3D 7E BlueCN+001 D-513D7E
84 C7 EA 64 45 87 Xperia X Compact
Somewhere in my script I changed the IFS (Internal Field Separator) without setting it back to the original value.
IFS=':'
Is this normal behaviour?
I know I can redirect the output to a file with hcitool scan>scanres
but I want to avoid this if possible.