Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 我想在匹配后在shell脚本中使用sed命令在文件中添加java选项行_Linux_Bash_Shell_Unix_Scripting - Fatal编程技术网

Linux 我想在匹配后在shell脚本中使用sed命令在文件中添加java选项行

Linux 我想在匹配后在shell脚本中使用sed命令在文件中添加java选项行,linux,bash,shell,unix,scripting,Linux,Bash,Shell,Unix,Scripting,Hi希望在shell中使用sed命令在下面添加行,但它与下面的行不同 JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.debug.DebugSecuritySSL=true -Dweblogic.debug.DebugSSL=true -Dweblogic.StdoutDebugEnabled=true -Dweblogic.log.StdoutSeverityLevel=Debug -Dweblogic.log.LogSeverity=Debug" 它跳过

Hi希望在shell中使用sed命令在下面添加行,但它与下面的行不同

JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.debug.DebugSecuritySSL=true -Dweblogic.debug.DebugSSL=true -Dweblogic.StdoutDebugEnabled=true  -Dweblogic.log.StdoutSeverityLevel=Debug -Dweblogic.log.LogSeverity=Debug"
它跳过
“${JAVA_OPTIONS}和”

我尝试使用
sed

var="JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.debug.DebugSecuritySSL=true -Dweblogic.debug.DebugSSL=true -Dweblogic.StdoutDebugEnabled=true  -Dweblogic.log.StdoutSeverityLevel=Debug -Dweblogic.log.LogSeverity=Debug""
sed -i "/minimumprotocol=/a \
$var" file.txt

提前感谢您的帮助。

您应该避开
$

var="JAVA_OPTIONS=\${JAVA_OPTIONS} -Dwe..."

您尝试过哪些
sed
命令?我们在这里更多地是为了帮助解决以下特定问题:“我尝试了X,但它没有达到我预期的效果,反而导致了一个错误!”伴随着一个。更新命令它也跳过了行的末尾和中间的“”,非常感谢我得到了它