http://qs321.pair.com?node_id=1198739


in reply to creating Shell Script using Perl

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...