http://qs321.pair.com?node_id=925659


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.