Skip to content

Commit 34ca30a

Browse files
authored
Merge pull request #3 from davosian/master
Minor improvements and fixes
2 parents cf0f6d2 + 417515a commit 34ca30a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/connector.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SYSTEM_PROFILER=$(system_profiler SPBluetoothDataType 2>/dev/null)
22

3-
MAC_ADDRESS=$(grep -B8 "Minor Type: Headphones" <<< "${SYSTEM_PROFILER}" | awk '/Address/{print $2}')
3+
MAC_ADDRESS=$(grep -B8 "Minor Type: Headphones" <<< "${SYSTEM_PROFILER}" | awk '/Address/{ lastline = $2 } END { print lastline }')
44
CONNECTED=$(grep -A10 "${MAC_ADDRESS}" <<< "${SYSTEM_PROFILER}" | awk '/Services:/{print 1}')
55
NAME=$(grep -B9 "Minor Type: Headphones" <<< "${SYSTEM_PROFILER}" | awk '/AirPods/{ print }' | sed -e 's/^ *//' -e 's/://')
66

0 commit comments

Comments
 (0)