Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: chomping the output of Shell.pm

by kcott (Abbot)
on Sep 09, 2012 at 05:11 UTC ( #992557=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ cat ~/.perldb
    for (qw{pwd date ls ps}) {
        $DB::alias{$_}
            = 's{^($_.*)$}{chomp(my $out = qx{$1}); print {$DB::OUT} $out}
    +e';
    }
    
  2. or download this
    $ perl -d -e 1
    
    ...
      501 74528 74527   0 23Aug12 ttys007    0:00.04 -bash
      DB<7> q
    $ 
    
  3. or download this
    $ cat ~/.perldb
    $DB::alias{$_} = 's{^$_(.*)$}{p qx{$_$1 | xargs echo -n}}' for qw{pwd 
    +date};
    
  4. or download this
    $ perl -d -e 1
    
    ...
      DB<4> date "+%Y-%m-%d"
    2012-09-09
      DB<5> q
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992557]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-10-24 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls