Maybe the second bit of output is sent to stderr instead of stdout? Try
hcitool scan > addr 2>&1.
If that works, use this to get it into a variable:
Code:
addr=$(hcitool scan 3>&1 >/dev/null 2>&3 | awk '{print $1}')
The
3>&1 part copies file descriptor 1 (stdout) to a new file descriptor 3.
>/dev/null discards stdout, and then
2>&3 redirects stderr to the new file descriptor. This means that the
awk process which is next in the pipeline can read from stdin what would previously have gone to stderr.