It is quite easy to write files from Perl, see open and print. Be sure to chmod (assuming UNIX). When calling the script using system or qx it is probably best to pass the full path name.
On the other hand, would it not be better to write it in Perl? Off hand I can't think of anything shell scripts can do (even the very latest versions) that Perl cannot. | [reply] |
There's nothing shell scripts can do that cannot be done in Perl1. But there are things that are easier done in a shell script than in Perl. Sourcing other shell scripts for instance (and hence, getting access to environment variables). You can't really beat
. /path/to/config/file
in Perl for ease, neither keystrokes.
1Of course, there's nothing a Perl program can do that cannot be done in Python, Java or C. That doesn't imply some people rather write Perl... | [reply] [d/l] |
Here's one way
perl -e 'system(qq(bash -c "echo I am a shell script"));'
That's rather nonsensical of course, but without further details on what you want to do, and why you would want to do it this way, I can't be much more helpful.
| [reply] [d/l] |
| [reply] |
| [reply] |