[英]Linux Shell scripting sed command
sed -r -i -e "s/AppId/$a/" -e "s/AccessToken/$b/" FacebookApi > /script/newapp
通过发出此命令,为什么程序无法执行,您能解决这个问题吗?
sed is an editor, not a shell interpretor. sed是编辑器,而不是shell解释器。 It execute SED instruction like subistitute for s///
but not batch or binary of other form (than sed instruction). 它执行SED指令,例如为s///
替代,但不执行其他形式的批处理或二进制形式(而不是sed指令)。 Execution stay at calling shell level and management (like variable substition between double quote in a sed instruction string that is treated before sed receive the full instruction) 执行停留在调用外壳程序级别和管理上(例如,在sed接收完整指令之前处理的sed指令字符串中双引号之间的变量替换)
The command is executed. 该命令被执行。 As you specified -i
it is modifying the specified file in place (and not generating any output). 如您指定的-i
它正在修改指定的文件(并且不生成任何输出)。
From the sed
man page: 在sed
手册页中:
-i extension Edit files in-place, saving backups with the specified extension. If a zero-length extension is given, no backup will be saved. It is not recommended to give a zero-length extension when in-place editing files, as you risk corruption or partial content in situations where disk space is exhausted, etc.
As sed
is directly modifying FacebookApi
standard output will be empty (as the file /script/newapp
) 由于sed
是直接修改的, FacebookApi
标准输出将为空(如文件/script/newapp
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.