4
#!/bin/sh
arr=(
a
b
c
)
sed "s/abc/${arr[@]}/" file
쉬 -x this_script.sh 오류와 결과를 보여
이미 큰 따옴표있다+ sed 's/abc/a b c/' file
:
+ arr=(a b c)
+ sed s/abc/a b c/ file
sed: -e expression #1, char 5: unterminated `s' command
은 그것이 있어야를 이 스크립트에서 왜 작동하게하려면 변수를 선언해야합니다 :
x=${arr[@]}
sed "s/abc/$x/" file