http://www.perlmonks.org?node_id=925698


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

Good catch Corion.
So what you want to do is open a shell with your tool setup script and in that shell enter your the second command. Something like the following might do it for you
#! /usr/bin/perl use strict; my $tool_shell = '/bin/toolsetup.pl -p coi -config d4 -t all -ov /nfs/ +home/akmvx/test -n toptest'; open (my $ts , "|-" , $tool_shell) || die "Failed to open tool setup:\n\tCommand:\t$tool_shell\n\tErro +r:\t$!\n"; print $ts "touch file1\n"; print $ts "$exit_command";
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^5: How to call Linux command sequentially
by mv.ashwin@gmail.com (Novice) on Sep 14, 2011 at 07:27 UTC
    Hurraahh!!!!!!! it worked...... Thanks a bunch!!! for all the who helped me in this. I appreciate it!! :o)
Re^5: How to call Linux command sequentially
by mv.ashwin@gmail.com (Novice) on Sep 14, 2011 at 12:28 UTC
    One more hiccup, i was able to execute the command in the shell which i created. But the perl lines right after the " print $ts "touch file1\n"; " is not getting executed. I know we have created a new shell here but how to come back to the perl code right after giving some command in shell i created. Its like I create the shell execute some command there if it reports error i want to log it than again create a shell execute some command & log its status. i wrote some perl to log the status but that code is not executing. Also the shell i created is getting exited without having "print $ts "$exit_command"; " in my code. Pls help :)