enhance portability (detect user-preferred bash, replace all greps with awk)

pull/836/head
nivesh 2026-01-21 05:00:05 -05:00 committed by GitHub
parent 0c147d745e
commit a9bce2179b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Check Root User
@ -66,7 +66,7 @@ install_gost() {
;;
esac
get_download_url="$base_url/tags/$version"
download_url=$(curl -s "$get_download_url" | grep -Eo "\"browser_download_url\": \".*${os}.*${cpu_arch}.*\"" | awk -F'["]' '{print $4}')
download_url=$(curl -s "$get_download_url" | awk -F'"' -v re=".*${os}.*${cpu_arch}.*" '/"browser_download_url":/ && $4 ~ re { print $4 }')
# Download the binary
echo "Downloading gost version $version..."