wcj75019 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I can't get my script to add another if statement after $1. This is the file I want to modify: #!/sbin/sh # Run rctladm to configure system resource controls based on the setti +ngs # previously saved by rctladm. See rctladm(1m) for instructions on ho +w to # modify resource control settings. # if [ -f /etc/rctladm.conf ] && [ -x /usr/sbin/rctladm ]; then /usr/sbin/rctladm -u fi I want to add another if statement after the last if/fi. Thanks,
#!/usr/bin/perl -w use strict; open SYS, "sysetup"; open OUT, '>', "/tmp/sysout"; my $here=<<HERE; if /usr/bin/pgrep -x -u 0 -P 1 ltps& >/dev/null 2>&1; +then echo "$0: ltps is already running" exit 0 fi HERE while(<SYS>){ s/^(if.*rctladm.conf.*?fi)/$1\n$here/m; print OUT; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: add after $1
by hipowls (Curate) on Mar 20, 2008 at 22:25 UTC | |
by wcj75019 (Acolyte) on Mar 20, 2008 at 22:45 UTC | |
|
Re: add after $1
by NetWallah (Canon) on Mar 20, 2008 at 22:11 UTC | |
by wcj75019 (Acolyte) on Mar 20, 2008 at 22:25 UTC |