需要有关如何转义此perl命令的帮助吗
我尝试用perl执行这个命令,它在bash中运行良好。但是当从perl执行时,它不起作用。也许我没有逃脱正确的角色?你能帮忙吗需要有关如何转义此perl命令的帮助吗,perl,escaping,command,system,Perl,Escaping,Command,System,我尝试用perl执行这个命令,它在bash中运行良好。但是当从perl执行时,它不起作用。也许我没有逃脱正确的角色?你能帮忙吗 my $comp_command = "./jnx_comp.py <(/usr/bin/ssh $boss\@$ftpServer[$j] '/bin/cat $compList[0]') <(/usr/bin/ssh $boss\@$ftpServer[$j] '/bin/cat $compList[1]')" my $result = `$comp_
my $comp_command = "./jnx_comp.py <(/usr/bin/ssh $boss\@$ftpServer[$j] '/bin/cat $compList[0]') <(/usr/bin/ssh $boss\@$ftpServer[$j] '/bin/cat $compList[1]')"
my $result = `$comp_command`;
my$comp_command=“./jnx_comp.py使用bash
执行时,它运行良好,因为它是一个有效的bash
命令
当使用Perlsh
执行时,它不起作用,因为它不是有效的sh
命令
如果要执行bash
命令,则需要实际执行bash
my $result = `bash -c bash_commmand_here`;
我们来解决一些插值问题
use String::ShellQuote qw( shell_quote );
my $remote_cmd1 = shell_quote('/bin/cat', $compList[0]);
my $remote_cmd2 = shell_quote('/bin/cat', $compList[1]);
my $ssh_cmd1 = shell_quote('/usr/bin/ssh', "$boss\@$ftpServer[$j]", $remote_cmd1);
my $ssh_cmd2 = shell_quote('/usr/bin/ssh', "$boss\@$ftpServer[$j]", $remote_cmd2);
my $bash_cmd = "./jnx_comp <( $ssh_cmd1 ) <( $ssh_cmd2 )";
my $sh_cmd = shell_quote('bash', '-c', $bash_cmd);
`$sh_cmd`
使用字符串::ShellQuote qw(shell_quote);
my$remote\u cmd1=shell_quote('/bin/cat',$compList[0]);
my$remote_cmd2=shell_quote('/bin/cat',$compList[1]);
my$ssh_cmd1=shell_quote('/usr/bin/ssh',“$boss\@$ftpServer[$j]”,$remote_cmd1);
my$ssh_cmd2=shell_quote('/usr/bin/ssh',“$boss\@$ftpServer[$j]”,$remote_cmd2);
my$bash_cmd=“./jnx_comp它在使用bash
执行时运行良好,因为它是一个有效的bash
命令
当使用Perlsh
执行时,它不起作用,因为它不是有效的sh
命令
如果要执行bash
命令,则需要实际执行bash
my $result = `bash -c bash_commmand_here`;
我们来解决一些插值问题
use String::ShellQuote qw( shell_quote );
my $remote_cmd1 = shell_quote('/bin/cat', $compList[0]);
my $remote_cmd2 = shell_quote('/bin/cat', $compList[1]);
my $ssh_cmd1 = shell_quote('/usr/bin/ssh', "$boss\@$ftpServer[$j]", $remote_cmd1);
my $ssh_cmd2 = shell_quote('/usr/bin/ssh', "$boss\@$ftpServer[$j]", $remote_cmd2);
my $bash_cmd = "./jnx_comp <( $ssh_cmd1 ) <( $ssh_cmd2 )";
my $sh_cmd = shell_quote('bash', '-c', $bash_cmd);
`$sh_cmd`
使用字符串::ShellQuote qw(shell_quote);
my$remote\u cmd1=shell_quote('/bin/cat',$compList[0]);
my$remote_cmd2=shell_quote('/bin/cat',$compList[1]);
my$ssh_cmd1=shell_quote('/usr/bin/ssh',“$boss\@$ftpServer[$j]”,$remote_cmd1);
my$ssh_cmd2=shell_quote('/usr/bin/ssh',“$boss\@$ftpServer[$j]”,$remote_cmd2);
我的$bash_cmd=“/jnx_comp”