sed命令在debian数据包的postinstall脚本中执行时留下空白文件 [英] sed command leaves blank file while executing it in a postinstall script of a debian packet

查看:124
本文介绍了sed命令在debian数据包的postinstall脚本中执行时留下空白文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!



我必须更换或删除文件中的某些字符串。



I使用以下语法:



Hi!

I have to replace or erase some strings in a file.

I use following syntax:

sed -i '2d;3d;6d;7d;9d;10d' /opt/atpcu/vfw/bin/vfw.checksum





此命令删除文件中的一些不需要的行,并且在控制台上运行良好。



我也试过这个命令(也适用于控制台)





This command removes some lines within the file which are not needed and works great on the console.

I have also tried this commmand (also works on the console)

sed '2d;3d;6d;7d;9d;10d' /opt/atpcu/vfw/bin/vfw.checksum > /opt/atpcu/vfw/bin/vfw.checksum.bak
mv /opt/atpcu/vfw/bin/vfw.checksum.bak  /opt/atpcu/vfw/bin/vfw.checksum







在控制台上这个命令完美的工作,但当我在debian数据包的postinstall脚本中执行此命令时,在安装该debian数据包后,我将该文件留空。



任何想法为什么?



哦,我还在postinstall脚本中对其他文件做了一些其他替换,例如:






On the console this commands work perfectly, but when I execute this command within the postinstall script of a debian packet it leaves me the file empty after installation of that debian packet.

Any ideas why?

Oh, I also do some other replacements on other files within the postinstall script like:

sed -i 's|.*/Linux_ppc/TEST|'/optrd/run/TEST'|g' /opt/TEST/etcsc/bin/TEST.check 2> /dev/null





这个命令在控制台和postinstall脚本中都有效(更改的文件不为空!)



问候



Adam



and this command works both on console and within the postinstall script(changed file is not empty!)

regards

Adam

推荐答案

这篇关于sed命令在debian数据包的postinstall脚本中执行时留下空白文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆