Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.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 Bash不';t在嵌套脚本中创建文件_Linux_Bash_File_Shell_Sed - Fatal编程技术网

Linux Bash不';t在嵌套脚本中创建文件

Linux Bash不';t在嵌套脚本中创建文件,linux,bash,file,shell,sed,Linux,Bash,File,Shell,Sed,当我运行调用第二个脚本的第一个脚本时,不会创建任何文件 但是,当我使用与“echo”上显示的代码相同的代码直接调用第二个时,将按预期运行 因此,我真的不知道哪里出了问题,因为代码是分开运行的 ./first_script.sh 2../espn 第一个脚本: #!/bin/bash echo "$2/$1" > format.temp format=$(<format.temp) format=$format"g.t*" echo "./second_script.sh $forma

当我运行调用第二个脚本的第一个脚本时,不会创建任何文件

但是,当我使用与“echo”上显示的代码相同的代码直接调用第二个时,将按预期运行 因此,我真的不知道哪里出了问题,因为代码是分开运行的

./first_script.sh 2../espn

第一个脚本:

#!/bin/bash
echo "$2/$1" > format.temp
format=$(<format.temp)
format=$format"g.t*"
echo "./second_script.sh $format"
./second_script.sh $format
注意-> 这些文件位于以下文件夹中:

../espn/2g.tf/discover/

../espn/2g.tfidf/discover/

注意->文件位于文件夹中:

../espn/2g.tf/discover/

../espn/2g.tfidf/discover/

这是什么意思??第一个目录中的第一个文件和第二个目录中的第二个文件?? 我认为您的问题在于访问第二个文件的路径

尝试使用abslute path调用第二个脚本('路径从/'开始)
如果您的主文件夹中有espn

~/espn/2g.tfidf/discover/second_script.sh $format

尝试在第二个文件中添加回显语句,以确保其可访问

尝试像这样添加回显标记:`./second_script.sh$format`我刚刚尝试过,但仍然不起作用:/
~/espn/2g.tfidf/discover/second_script.sh $format