[root@jenkins ~]# cat a1.pl
my $start_dt = $ARGV[0];
my $end_dt = $ARGV[1];
my $str=`echo --start-datetime='$start_dt' --stop-datetime='$end_dt'`;
print "\$str is $str\n";
[root@jenkins ~]# perl a1.pl '2016-12-31' '20171231'
$str is --start-datetime=2016-12-31 --stop-datetime=20171231
[root@jenkins ~]# perl a1.pl 2016-12-31 20171231
$str is --start-datetime=2016-12-31 --stop-datetime=20171231
此时虽然单引号,仍旧正常解析
[root@jenkins ~]# cat a2.pl
my $db_name=$ARGV[0];
my $table= $ARGV[1];
my $hostSql = qq{SELECT column_name from information_schema.columns where table_schema='$db_name' and table_name='$table'};
print "\$hostSql is $hostSql\n";
[root@jenkins ~]# perl a2.pl zjzc Client
$hostSql is SELECT column_name from information_schema.columns where table_schema='zjzc' and table_name='Client'
perl 单引号解析
最新推荐文章于 2022-09-11 11:21:13 发布