From fb1829898da169e967895df186a37c57a968a042 Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Sat, 8 Feb 2025 22:40:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/update_port.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bin/update_port.sh diff --git a/bin/update_port.sh b/bin/update_port.sh new file mode 100644 index 0000000..8edd27e --- /dev/null +++ b/bin/update_port.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径 +config_dir=$(readlink -f "$script_dir/../") # 配置文件绝对路径 +source $script_dir/utils/jq_util.sh + +old_port=$(jq -r '.listen' "$config_dir/config.json" | awk -F : '{print $2}') +read -p "请输入新的端口[当前端口: $old_port]: " port + +# 修改端口 +modify_json_file "$config_dir/config.json" ".listen" ":$port" + +echo "端口修改成功!新端口为: $port"