如何在bash变量中存储arg和带引号的arg值?

如何在bash变量中存储arg和带引号的arg值?,bash,Bash,假设我有两个脚本printargs.sh: #!/bin/bash echo 1=$1 echo 2=$2 echo 3=$3 和passargs.sh: #!/bin/bash arg1="-e \"hello there\"" ./printargs.sh $arg1 如何修改passargs.sh以将两个参数,-e和hello there传递到printargs.sh?i、 e.我想打印args.sh 1=-e 2=hello there 3= 我觉得这个问题困扰了我很多年了!我

假设我有两个脚本printargs.sh:

#!/bin/bash

echo 1=$1
echo 2=$2
echo 3=$3
和passargs.sh:

#!/bin/bash

arg1="-e \"hello there\""
./printargs.sh $arg1
如何修改passargs.sh以将两个参数,
-e
hello there
传递到printargs.sh?i、 e.我想打印args.sh

1=-e
2=hello there
3=
我觉得这个问题困扰了我很多年了!我得到它的唯一方法是创建两个变量。任何帮助都将不胜感激。

args=(-e 'hello there')
./printargs.sh "${args[@]}"