in reply to Re: Solaris - change hostname / ip / default-router-ip script
in thread Solaris - change hostname / ip / default-router-ip script

thanks for taking time correcting my code.

I was being lazy not to check the arguments because i am the only one use this. well. no excuse.

To the second suggestion(anchor one) you mentioned, i think a \b will do it. anchor requires the line start with that ip or hostname

>>better still if you don't put the one-liner perl script on the command line at all.

you put the regex in a seperate file then system calls it at once. that looks no much difference than directly calling it in the same perl script though.

  • Comment on Re^2: Solaris - change hostname / ip / default-router-ip script

Replies are listed 'Best First'.
Re^3: Solaris - change hostname / ip / default-router-ip script
by graff (Chancellor) on Feb 21, 2005 at 15:07 UTC
    you put the regex in a seperate file then system calls it at once. that looks no much difference than directly calling it in the same perl script though.

    The difference is that in my version, the command line passed to system() contains only things that are created by the script itself -- including the name of a file that stores a temporary perl script to be run -- so the shell launched by system() won't do anything unexpected. In your version, where the content of the temp. perl script is included in the command line, unexpected things in the script (e.g. shell metacharacters that were not properly escaped) could cause the system() call to do things that you don't want.

    There might be a problem with the temp. perl script, and in my version, the perl job in the subshell would just exit with an error condition. In your version, the problem might be that some characters in the temp script are being interpreted by the shell.

    Another way around this is to use a multi-arg system() call.