pratikmonu has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am trying to create a shell script to be executed inside a perl code, Problem:- The Script gets created, but the Variable value is not set.
sub create_db_install_val(){ $File_name="$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); }
When I execute this perl fucntion, it writes shell script where the $FILE value is not set, something Like this:-
#!/bin/sh FILE="/scratch/pratranj/DB_11.2.0.1.0/config/setup.log" STRING="Completed creating database instance" EXIT=1 while : ;do [[ -f '""' ]] && grep -q "" "" && echo "DB Installation is complet +ed" && break sleep 5 done
Please suggest how to get the value of $FILE and $STRING in the shell file created within perl
Thanks, PR
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: creating Shell Script using Perl
by kcott (Archbishop) on Sep 06, 2017 at 05:41 UTC | |
|
Re: creating Shell Script using Perl
by afoken (Chancellor) on Sep 06, 2017 at 05:03 UTC | |
by pratikmonu (Novice) on Sep 06, 2017 at 05:25 UTC | |
by Happy-the-monk (Canon) on Sep 06, 2017 at 05:47 UTC | |
by pratikmonu (Novice) on Sep 06, 2017 at 05:58 UTC | |
by AnomalousMonk (Archbishop) on Sep 06, 2017 at 05:48 UTC | |
|
Re: creating Shell Script using Perl
by vinoth.ree (Monsignor) on Sep 06, 2017 at 06:04 UTC | |
by AnomalousMonk (Archbishop) on Sep 06, 2017 at 06:54 UTC | |
by vinoth.ree (Monsignor) on Sep 06, 2017 at 08:19 UTC | |
|
Re: creating Shell Script using Perl
by manoj_speed (Prior) on Oct 10, 2017 at 11:37 UTC |