Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: How to call Linux command sequentially

by Utilitarian (Vicar)
on Sep 13, 2011 at 13:30 UTC ( [id://925698]=note: print w/replies, xml ) Need Help??


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 :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found