#!/usr/bin/perl -w use strict; open SYS, "sysetup"; open OUT, '>', "/tmp/sysout"; my $here=</dev/null 2>&1; then echo "$0: ltps is already running" exit 0 fi HERE while(){ s/^(if.*rctladm.conf.*?fi)/$1\n$here/m; print OUT; }