English 中文(简体)
1. 保持从每稿中排出的外部壳环境
原标题:Maintain external shell environment from within a Perl script
  • 时间:2011-10-04 12:39:18
  •  标签:
  • perl
  • bash
  • db2

我有一份需要使用IBM db2处理某些指挥的书。 麻烦在于, d2的连接在每个职业中都受到束缚。

这一工作:

$> db2 connect to foo
$> perl -e  print `db2 list tables for schema bar|some_filter`; 

也没有:

$> perl -e  print `db2 connect to foo`; print `db2 list tables for schema bar|some_filter`; 

也没有:

$> perl -e  print `db2 connect to foo && db2 list tables for schema bar|some_filter`; 

在每个案件中,第二次指挥所执行时都失去了联系。

这项工作:

#!/usr/bin/perl
print `db2 connect to foo`;
print `db2 list tables for schema bar`;

但是,这并不意味着:

#!/usr/bin/perl
print `db2 connect to foo`;
print `db2 "select count * from bar"`;

一项工作是,从Perl生产一个双管带,执行该双管,但这是直接的。 是否有办法?

最佳回答
问题回答

为什么不使用DBI,而不用打字。 那么,只要你愿意,你就可以维持联系,重新利用现有的联系。





相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签