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

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.

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