netrans/setup.sh

33 lines
706 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# === 脚本目录 ===
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_DIR="$CURRENT_DIR/netrans_cli"
# 定义要追加到 .bashrc 的环境变量
ENV_VARS=(
"export PATH=\"\$PATH:$SCRIPT_DIR\""
"export NETRANS_PATH=\"$CURRENT_DIR/bin\""
)
# 扫描 .bashrc逐条添加不存在的变量
for LINE in "${ENV_VARS[@]}"; do
if grep -Fxq "$LINE" ~/.bashrc; then
echo "已存在:$LINE"
else
echo "$LINE" >> ~/.bashrc
echo "已添加:$LINE"
fi
done
cd netrans_py
pip3 install -e .
echo ""
echo "所有变量已添加到 ~/.bashrc"
echo "请运行以下命令使其立即生效:"
echo ""
echo " source ~/.bashrc"
echo ""