& is a sh thing
But, in a sense, that's an oversimplification. I mean, if I run (in Cygwin's bash shell):
Rob@desktop2 ~
$ perl -e 'system "notepad &"'
then that works as intended. But if I invoke ActivePerl (in the very same Cygwin shell) by running:
Rob@desktop2 ~
$ /cygdrive/c/_32/ap822/bin/perl -e 'system "notepad &"'
then I get the precise (undesired) behaviour as described by the op - where I get told that &.txt does not exist.
Is it simply a case of "ActivePerl always assumes that it's being run in the cmd shell" ? ... or is there a more erudite way of explaining this ?
Cheers, Rob
| [reply] [d/l] [select] |
There's no assumption being made as to which shell launched Perl. As documented, the shell used by system is constant.
On most platforms, that shell is /bin/sh (no matter what the user's login shell is or which process launched perl), so system's argument must be a sh command. & can be used to run a background task in sh.
On Windows (cygwin aside), that shell is cmd, so system's argument must be a cmd command. start can be used to run a background task in cmd.
| [reply] [d/l] [select] |
Thanks everyone for your posts. The suggestion of using 'system(1, "...command...");" worked. THANKS.
Interestingly, before I even tried to use "system", I thought there might be more than one parameter I could pass to it, but I couldn't find documentation on it, so please let me ask a couple of questions about Perl documentation.
I tried "perldoc system", but it said there was no documentation on "system". Where/how could I find the syntax for "system", and a brief synopis?
Also, how can I list all of the functions contained in a Perl module, and how do I find a synopsis and syntax of a specific function within a module? (For example, "perldoc Win32::TestGui" gives me some information, but not all of what I would need to effectively use that module).
Thanks, again. | [reply] |
| [reply] [d/l] [select] |
| [reply] |