有没有办法通过引用值来访问变量?
BAR=("hello", "world")
function foo() {
DO SOME MAGIC WITH $1
// Output the value of the array $BAR
}
foo "BAR"
Run Code Online (Sandbox Code Playgroud) 我想要这个脚本:
#!/bin/sh
cat source.txt | sed "/replace_text_holder/ {
r file.txt
d
}" | cat
Run Code Online (Sandbox Code Playgroud)
就这样写这样:
cat source.txt | sed "/replace_text_holder/ { r file.txt d }" | cat
Run Code Online (Sandbox Code Playgroud)
但这不起作用.任何人都知道为什么,和/或我如何解决它?
我目前受到这个错误的骚扰:
unbalanced "{"
Run Code Online (Sandbox Code Playgroud)
我尝试插入"\n"以使其相信有一个新行,但这不起作用.
很明显我不知道我在做什么......