From 001d1c5783cc823b0da846ce23a1af93e4d890b3 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Wed, 10 Apr 2024 21:41:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=20bash=20=E4=B8=8B=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #73 --- README.en.md | 2 +- README.md | 2 +- reinstall.sh | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.en.md b/README.en.md index 3dbfbd6..2bb9c0f 100644 --- a/README.en.md +++ b/README.en.md @@ -133,7 +133,7 @@ bash reinstall.sh windows \ ```bash bash reinstall.sh windows \ - --image-name 'Windows 10 Enterprise LTSC 2021' + --image-name 'Windows 10 Enterprise LTSC 2021' \ --lang zh-cn ``` diff --git a/README.md b/README.md index 5681348..75e266c 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ bash reinstall.sh windows \ ```bash bash reinstall.sh windows \ - --image-name 'Windows 10 Enterprise LTSC 2021' + --image-name 'Windows 10 Enterprise LTSC 2021' \ --lang zh-cn ``` diff --git a/reinstall.sh b/reinstall.sh index f6f3b3d..1f4894b 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -594,20 +594,10 @@ get_windows_iso_links() { esac } - # 部分 bash 不支持 $() 里面嵌套case,所以定义成函数 - label_msdn=$(get_label_msdn) - label_vlsc=$(get_label_vlsc) - - if grep -Ewq 'ltsb|ltsc' <<<"$edition"; then - is_ltsc=true - else - is_ltsc=false - fi - - page=$( + get_page() { if [ "$arch_win" = arm64 ]; then echo arm - elif $is_ltsc; then + elif is_ltsc; then echo ltsc elif [ "$server" = 'server' ]; then echo server @@ -618,7 +608,17 @@ get_windows_iso_links() { ;; esac fi - ) + } + + is_ltsc() { + grep -Ewq 'ltsb|ltsc' <<<"$edition" + } + + # 部分 bash 不支持 $() 里面嵌套case,所以定义成函数 + label_msdn=$(get_label_msdn) + label_vlsc=$(get_label_vlsc) + page=$(get_page) + page_url=https://massgrave.dev/windows_${page}_links.html info "Find windows iso" @@ -640,7 +640,7 @@ get_windows_iso_links() { # en-us_windows_10_iot_enterprise_ltsc_2021_arm64_dvd_e8d4fc46.iso # en-us_windows_10_iot_enterprise_version_22h2_arm64_dvd_39566b6b.iso # sed -Ei 和 sed -iE 是不同的 - if $is_ltsc; then + if is_ltsc; then sed -Ei '/ltsc|ltsb/!d' $tmp/win.list else sed -Ei '/ltsc|ltsb/d' $tmp/win.list