Skip to content

Commit 1a1629b

Browse files
author
Dinesh Kumar
committed
Fix: redirect output without echo as it doesn't emit newline
1 parent 9f93393 commit 1a1629b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lazy-connect.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ function _lazy_connect_init() {
1313

1414
function _lazy_connect_vpn_refresh() {
1515
echo "refreshing vpn..."
16-
vpnNames=$(osascript <<EOF
16+
cp $config_dir/vpns ${TMPDIR}lc_vpns
17+
osascript <<EOF |
1718
tell application "System Events"
1819
tell process "SystemUIServer"
1920
set vpnMenu to (menu bar item 1 of menu bar 1 where description is "VPN")
@@ -33,12 +34,9 @@ function _lazy_connect_vpn_refresh() {
3334
end tell
3435
end tell
3536
EOF
36-
)
37-
cp $config_dir/vpns ${TMPDIR}lc_vpns
38-
updated_vpns=$(echo $vpnNames | tr , "\n" | xargs -I{} echo {})
39-
echo $updated_vpns > $config_dir/vpns
40-
echo "Updated VPN List:"
41-
diff $config_dir/vpns ${TMPDIR}lc_vpns
37+
tr ',' '\n' | sed 's/^[[:space:]]//g' > $config_dir/vpns
38+
echo "Updated VPN List:"
39+
diff $config_dir/vpns ${TMPDIR}lc_vpns
4240
}
4341

4442
function _lazy_connect_usage() {

0 commit comments

Comments
 (0)