Solved

How to get the echo command via perl?

Posted on 2002-04-25
2
199 Views
Last Modified: 2010-03-05
I need to know how to do these built-in unix commands line and put it in a perl script-

setshot cuetest/wrappers
   shot
   cd wrappers_cmp_v3/
   ls
   cd 2kfa_lg8/
   netscape -remote "openUrl(http://vfo-server/vfo/jsp/VfoSubmit.jsp?show=${SHOW}&shot=${SHOT})"
    seqls
     seqls *.rla *.cin
   echo $SHOW
   echo $SHOT
   perl -e 'print "$ENV{SHOW} $ENV{SHOT}";'
   pwd   --- # this should print the current directory  example - /net/vol01/shot/curtest.../2fa
and I need to strip out "net/vol01/"
so that
$FILE = /shot/cuetest/wrappers/pix/out/wrappers-2/2fa


So that finally the script looks like this-
#file bla.pl

#!/usr/local/bin/perl

use strict;

## get all the above unix commands ie ..show, shot, filespec

## and then does this...
if ( 0 != system( "netscape -remote 'openUrl(http://vfo-server/vfo/jsp/VfoSubmit.jsp?show=$ENV{SHOW}&shot=$ENV{SHOT}&owner=$ENV{owner}&file=/whatever )' 2> /dev/null" ) ) {

    print "Netscape not running, launching fresh browser\n";

    system( "netscape 'http://vfo-server/vfo/jsp/VfoSubmit.jsp?show=$ENV{SHOW}&shot=$ENV{SHOT}&owner=$ENV{owner}&file=/whatever' 2> /dev/null" );

}

Any suggestions...

Thanks



0
Comment
Question by:sdesar
2 Comments
 
LVL 6

Accepted Solution

by:
andreif earned 50 total points
Comment Utility
To execute shell command you can use different ways:

# the easiest way, $output will contain command line output
$output = `command`;

# you can use system(), it returns exit code returned by UNIX programm

$code = system("commands");
0
 

Author Comment

by:sdesar
Comment Utility
how do i search for a string that -
"/net/vol01/shot/curtest.../2fa.ca"

and I need to print everything from "/shot... " onwords...
so that
$FILE = /shot/cuetest/wrappers/pix/out/wrappers-2/2fa

Any suggestions....
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now