Как запустить все аргументы командной строки через другую оболочку?

Попробуйте это,

#complete_robotpath=() ### not used in script... so commented
IFS=','
A=Basic-Call,Call-Hold  ## In shell, we dont prefix with $ while declaring variable and should not have space in value.
B=VoLTE-VoLTE,VoLTE-3G
read -ra ADDR1 <<< "$A" ## In shell, we should pass value of a variable by prefixing with $
read -ra ADDR2 <<< "$B" IFS=',' ## In shell, we should pass value of a variable by prefixing with $
for i in "${ADDR1[@]}";
do
  for j in "${ADDR2[@]}";
  do
  robot_path+=`echo $i/$j/` ## "+=" to concatinate string and sufix by / as expected result
  done
done

pybot_exec_cmd=`echo $robot_path`
echo $pybot_exec_cmd

Выход:

Basic-Call/VoLTE-VoLTE/Basic-Call/VoLTE-3G/Call-Hold/VoLTE-VoLTE/Call-Hold/VoLTE-3G/
0
25.11.2021, 22:39
1 ответ

man bash:

-c
If the -c option is present, then commands are read from the first non-option argument command_string. If there are arguments after the command_string, the first argument is assigned to $0 and any remaining arguments are assigned to the positional parameters. The assignment to $0 sets the name of the shell, which is used in warning and error messages.

tempenv () { bash -c 'set -x; : "$@"' foo "$@"; }

tempenv ls -l 'foo bar'
+ : ls -l 'foo bar'

Так что это вам подойдет:

#!/bin/bash
setarch... /bin/bash -c '"$@"' tempenv-subshell "$@"
3
25.11.2021, 23:28

Теги

Похожие вопросы