[comp.lang.perl] /bin/sh for all

merlyn@iwarp.intel.com (Randal Schwartz) (06/17/90)

In article <72A$+6+@ads.com>, dglo@ADS (Dave Glowacki) writes:
| >	$result = `perl -e 'print STDERR "hello world\n"' 2>&1`;
| >	print "<$result>";
| 
| Is this guaranteed, even if the user's shell (or SHELL environment variable)
| is set to /bin/csh?
| 
| If so, is this also true for pipes-as-filehandles (as in:
| 	open(SOMETHING, "|program >logfile 2>&1");
| or something like that?

The manpage says that exec(LIST) calls execvp(), which ignores the
value of the envariable SHELL, calling /bin/sh (the One True Shell) at
will.  Two sentences later, it explicity mentions calling /bin/sh "if
there are any [shell metacharacters]".  I had presumed that all
shell-type strings were parsed using the same mechanism (except for
<*>, see below).

For kicks, if you have /bin/csh on your system, try

print <;echo {a,b,c}{1,2,3}{do,re,mi}>

Weird, huh!

print <;echo Just another perl hacker,>
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/