From 4381c3c4ed05e3c861c2153d9dd7478f68e4bac4 Mon Sep 17 00:00:00 2001 From: Carl Menezes Date: Fri, 11 Aug 2023 13:03:15 +1200 Subject: [PATCH] Use sub-shells instead of pushd --- .github/scripts/update-docs-link.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/scripts/update-docs-link.sh b/.github/scripts/update-docs-link.sh index b559b2e2ec..014b6a646a 100755 --- a/.github/scripts/update-docs-link.sh +++ b/.github/scripts/update-docs-link.sh @@ -17,11 +17,12 @@ fi FILE=_typescript.mdx -pushd $CLONE_DIR -if [[ "$OSTYPE" == "darwin"* ]]; then - # On Mac OS, sed requires an empty string as an argument to -i to avoid creating a backup file - sed -i '' -E "s/[0-9]\\.[0-9]\\.[0-9](.* class=\"ts-immutable-sdk-ref-link\")/$VERSION\1/g;" $FILE -else - sed -i -E "s/[0-9]\\.[0-9]\\.[0-9](.* class=\"ts-immutable-sdk-ref-link\")/$VERSION\1/g;" $FILE -fi -popd +( + cd $CLONE_DIR; + if [[ "$OSTYPE" == "darwin"* ]]; then + # On Mac OS, sed requires an empty string as an argument to -i to avoid creating a backup file + sed -i '' -E "s/[0-9]\\.[0-9]\\.[0-9](.* class=\"ts-immutable-sdk-ref-link\")/$VERSION\1/g;" $FILE + else + sed -i -E "s/[0-9]\\.[0-9]\\.[0-9](.* class=\"ts-immutable-sdk-ref-link\")/$VERSION\1/g;" $FILE + fi +)