[英]Fix the "-e" is deprecated warning with gnome-terminal
我有以下腳本。
#!/bin/bash
# Run abc-app services
cd abc-app/packages/auth-service
tab=" --tab"
options_1=()
options_2=()
cmd_1[1]="yarn start"
cmd_1[2]="cd ../../api/shipper; yarn start:shipper"
cmd_1[3]="cd ../../frontend/shipper; yarn dev"
cmd_2[1]="yarn start:procure-app"
cmd_2[2]="yarn start:procure-worker"
cmd_2[3]="yarn start:mail-worker"
cmd_2[4]="yarn start:transporter"
cmd_2[5]="cd ../frontend/shipper; yarn dev"
cmd_2[6]="cd ../frontend/transporter; yarn dev"
for i in 1 2 3; do
options_1+=($tab -e "bash -c '${cmd_1[i]} ; bash'" )
done
for j in 1 2 3 4 5 6; do
options_2+=($tab -e "bash -c '${cmd_2[j]} ; bash'" )
done
gnome-terminal "${options_1[@]}"
cd
cd Documents/Code/abc-procure
gnome-terminal "${options_2[@]}"
當我使用./startServices.sh
運行腳本時,它按預期運行但出現以下警告
# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
我看到這只是我需要做的語法更改,但不確定如何應用並使其發揮作用。
如消息所述,您應該使用--
將選項與要執行的命令分開:
for i in 1 2 3; do
options_1+=("$tab" -- bash -c "${cmd_1[i]} ; bash" )
done
此外,您不應在$tab
值的開頭放置空格。 利用
tab="--tab"
你需要像
for i in 1 2 3; do
gnome-terminal $tab -- bash -c "${cmd_1[i]} ; bash"
done
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.