1
我在文件中的一行这种替换文本使用sed
integer, parameter :: L = 2 !Size of the system
其中数字2
可以是任意整数数量。我想使用sed
找到这一行,并用另一个替换该号码的值。
我想:
$ L=5
$ sed -i '/L = /c\integer, parameter :: L = $L !Size of the system' moduleselfcons.f90
但在我修改过的文件我在最后:
integer, parameter :: L = $ !Size of the system
,而不是:
integer, parameter :: L = 5 !Size of the system
问题是什么?
[在bash shell脚本的命令中扩展单引号内变量的可能重复](http://stackoverflow.com/questions/13799789/expansion-of-variable-inside-single-quotes-in-a- command-in-bash-shell-script) – 2014-10-27 15:09:58