相关疑难解决方法(0)

sed:无法读取:没有这样的文件或目录

在临时文件夹中解压缩存档后,我将其用作文件夹中每个文件的 str_replace

find "$tmp" -type f | xargs sed -i "s/${targetsubstring}/${newsubstring}/g"
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

sed: can't read /tmp/tmp.Q18p8BRYcc/steam: No such file or directory
sed: can't read engine.txt: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我的 tmp 变量:

tmp=mktemp -d

我究竟做错了什么?

更新

archive=`readlink -e $1` #First param is tar archive without file structure (only text files inside)
targetsubstring=$2 #Substring to replace
newsubstring=$3 #Substring to replaced by
tmp=`mktemp -d` #Create a room to unzip our archive

if [ -f "$archive" ]; #Check if archive exist …
Run Code Online (Sandbox Code Playgroud)

linux sed

8
推荐指数
1
解决办法
5万
查看次数

标签 统计

linux ×1

sed ×1