值I有(其需要计算的对系统打开的文件总和为指定的用户程序)的代码的一部分:打印仅一个的/所需的在/ foreach循环
for my $opt_u (@opt_u){
my $generic_acc_open = `/usr/sbin/lsof -u $opt_u | /usr/bin/wc -l`;
chomp ($generic_acc_open);
#print "$open";
print "Number of open files for users:$opt_u[0]=$generic_acc_open**$opt_u[1]=$generic_acc_open\n;"
}
其中opt_u
为用户参数在cli上指定。
我的问题是,当我运行一个程序(./proc_limit -u root jenkins
)我得到的输出是这样的:
Number of open files for users:root=85**jenkins=85
;Number of open files for users:root=13**jenkins=13
我想在一个一线得到输出,可能这是不可能的,因为在这种情况下数组被指定为参数两次(对于两个用户)。是否有可能与/ foreach循环或我应该使用别的东西在这样一行来获得输出:
Number of open files for users:root=85**jenkins=13
放下'\ n'也许? – Sobrique 2014-10-05 09:07:31