简体   繁体   English

Unix Shell在Perl中的“ -x”选项

[英]Unix Shell's '-x' Option in Perl

When running a Unix shell script you can specify the -x option to have the shell print the actual command being executed, after all interpolation has been completed. 在运行Unix Shell脚本时,您可以指定-x选项,以在所有插值完成后让Shell打印正在执行的实际命令。 For example, if we run this script (script.sh): 例如,如果我们运行以下脚本(script.sh):

#!/usr/bin/sh

var='hello, world'
echo $var

with: 与:

sh -x script.sh

we get 我们得到

+ var='hello, world'
+ echo hello, world
hello, world  

How can I get this same behavior for a perl script? 如何为Perl脚本获得相同的行为?

安装我的Devel::DumpTrace模块并运行

perl -d:DumpTrace my_script.pl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM