将脚本执行都换成绝对路径
This commit is contained in:
parent
f7c057fb78
commit
e563b33517
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare path_script=$1
|
||||
declare pick
|
||||
echo "========Automation========"
|
||||
echo "1.自动备份"
|
||||
@ -48,10 +49,10 @@ fi
|
||||
|
||||
case $pick in
|
||||
'1')
|
||||
bash "${PWD}/Config/Automation/backup.sh" "$path" "$cron"
|
||||
bash "${path_script}/Config/Automation/backup.sh" "$path" "$cron"
|
||||
;;
|
||||
'2')
|
||||
bash "${PWD}/Config/Automation/update.sh" "$path" "$cron"
|
||||
bash "${path_script}/Config/Automation/update.sh" "$path" "$cron"
|
||||
;;
|
||||
'3')
|
||||
if ! command -v docker &> /dev/null; then
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare path_script=$1
|
||||
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "docker未安装"
|
||||
exit
|
||||
@ -91,7 +93,7 @@ elif [[ "${pick}" -gt "$((${pick_number}-${#pick_array[*]}))" && "${pick}" -le "
|
||||
exit
|
||||
fi
|
||||
|
||||
bash "${PWD}/Config/Docker/${pick_array[${pick}]}.sh" "$file_path" "$port"
|
||||
bash "${path_script}/Config/Docker/${pick_array[${pick}]}.sh" "$file_path" "$port"
|
||||
echo "${pick_array[${pick}]}安装完成,访问端口${port}"
|
||||
fi
|
||||
|
||||
|
5
Run.sh
5
Run.sh
@ -8,13 +8,14 @@ fi
|
||||
declare -a pick_array
|
||||
declare pick_number
|
||||
declare pick
|
||||
declare path_script=$(dirname $0)
|
||||
|
||||
while true
|
||||
do
|
||||
|
||||
pick_number=0
|
||||
echo "======Linux工具箱======"
|
||||
for i in "${PWD}/Menus/"*
|
||||
for i in "${path_script}/Menus"/*
|
||||
do
|
||||
pick_number=$((pick_number + 1))
|
||||
pick_array[$pick_number]=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
|
||||
@ -24,7 +25,7 @@ echo "======Linux工具箱======"
|
||||
read -p "请输入要使用的功能:" pick
|
||||
if [[ "${pick}" -gt 0 && "${pick}" -le "${#pick_array[*]}" ]];then
|
||||
clear
|
||||
bash "${PWD}/Menus/${pick_array[$pick]}.sh"
|
||||
bash "${path_script}/Menus/${pick_array[$pick]}.sh ${path_script}"
|
||||
else
|
||||
exit
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user