我必须运行两个脚本,但第二个脚本只会在第一个脚本成功时运行。
First script
server_name=$1;
src_path=$2;
dst_path=$3;
dst_dir=$4;
cd $src_path;
smbclient //$server_name -A ~/\.smbclient -c "cd $dst_path;mkdir $dst_dir;cd $dst_dir;pwd; recurse; prompt; mput *; exit;";
上面的脚本将内容从源路径复制到远程服务器中的目录。
second script
#!/usr/bin/python
import sys
import os
import subprocess
project = sys.argv[1]
path = sys.argv[2]
print "\n inside second script"
fileName = "myfile.html"
file = open(fileName, "a")
if file:
file.write('Release Locations:<br>\n' +
'<ul>\n' +
'<li><a href="file://' + path + '">file://' + path + '</a></li>\n' +
'<li><a href="smb://' + path + '">smb://' + path + '</a></li>\n' +
'</ul>')
else:
exit(1)
command(control don't go to 2nd script)
./first_script.sh server_name/Shared /home/myname/work/target Software/target required_files && python second_script.py sony server_name/Shared/Software/target/required_files
command(control don't go to 2nd script)
./first_script.sh server_name/Shared /home/myname/work/target Software/target required_files || python second_script.py sony server_name/Shared/Software/target/required_files
command(control go to 2nd script)
./first_script.sh server_name/Shared /home/myname/work/target Software/target required_files;python second_script.py sony server_name/Shared/Software/target/required_files
执行第一个脚本&amp;&amp;或||使用第二个脚本,控制不会进入第二个脚本。
status of first_script when run individually
:0(通过运行echo $?检查)
第一个脚本成功复制带有一些警告的内容。
如果我单独运行第二个脚本,它就会运行。
warnings
WARNING: The "idmap uid" option is deprecated
WARNING: The "idmap gid" option is deprecated
Questions
由于这个警告,第二个脚本没有执行?
如何执行第二个脚本脚本?