From 8930b1d426346408898bfba58ecd717794ae9a9c Mon Sep 17 00:00:00 2001 From: Kevin Cotugno Date: Thu, 22 Nov 2018 11:11:32 -0800 Subject: [PATCH] grep -P isn't supported by busy box --- .ssh-sentinel | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.ssh-sentinel b/.ssh-sentinel index 21126c7..b05672b 100644 --- a/.ssh-sentinel +++ b/.ssh-sentinel @@ -22,5 +22,11 @@ if [[ -e $file ]]; then fi fi -export `ssh-agent -s | grep -oP "^.+(?=; export)" | tee "$file"` +export $(ssh-agent -s | + awk '{ + if ($1 ~ ".*=.*;") { + print substr($1, 0, length($1) - 1) + } + }' | + tee "$file") chmod 600 "$file"