Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi pratikmonu

Look at the below code I have just changed the print statement with 'single quote' to stop the variable interpolation to use the variable as it is. In your code perl looks for scalar variable $FILE and $STRING.

use strict; use warnings; sub create_db_install_val(){ my $File_name=$ENV{'HOME'}."/DB_INSTALL_VALIDATION.sh"; print "\n Shell name to validate DB Installation Completion is $File_n +ame\n"; open (FILE,">$File_name") or die "cannot open $File_name file"; print FILE "#!/bin/sh\n"; print FILE "FILE=\"/scratch/pratranj/DB_11.2.0.1.0/config/setup.log\"\ +n"; print FILE "STRING=\"Completed creating database instance\"\n"; print FILE "EXIT=1\n"; print FILE "while : ;do\n"; print FILE ' [[ -f "$FILE" ]] && grep -q "$STRING" "$FILE" && echo +"DB Installation is completed" && break',"\n"; print FILE "sleep 5\n"; print FILE "done\n"; close(FILE); }
Updated the code after Re^2: creating Shell Script using Perl

All is well. I learn by answering your questions...

In reply to Re: creating Shell Script using Perl by vinoth.ree
in thread creating Shell Script using Perl by pratikmonu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-25 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found