Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^5: How to call Linux command sequentially

by graff (Chancellor)
on Sep 13, 2011 at 09:33 UTC ( #925659=note: print w/replies, xml ) Need Help??


in reply to Re^4: How to call Linux command sequentially
in thread How to call Linux command sequentially

You could try something like:
#!/usr/bin/perl use strict; my $shpid = open( SH, '|-', '/bin/bash' ) or die "Can't launch bash: $ +!\n"; my @command_list = ( "first_command args ...\n", "second_command args ...\n" ... ); for my $cmd ( @command_list ) { print SH $cmd; } print SH "exit\n"; waitpid( $shpid, 0 );
If the list of commands actually includes things that change the shell environment for subsequent commands, that should work as intended.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2020-08-14 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (76 votes). Check out past polls.

    Notices?