in reply to Re^2: spawning shell commands with aliases
in thread spawning shell commands with aliases

Better example of why you want this, but this just goes more to prove that you really want to use the facilities of the shell itself.

You might could kludge something close to what you imagine by snooping $ENV{SHELL} and then really running system( qq{$ENV{SHELL} -c 'source $rc_for_shell{ $ENV{SHELL} } ; $command' } ), but that's at some point going to run afoul of quoting issues (aside from the ones the running user may encounter getting the command in as an argument to your mydiff to begin with). Or you're going to have someone set an alias in their shell and then come bug you because it's not working with your wrapper (because they're just testing something before they put it in their .xrc file, or it's a one off query they only need FIVE MINUTES AGO MY BOSS IS BREATHING DOWN MY NECK WHY DOES YOUR COMMAND NOT WORK YOU'RE GOING TO GET ME FIRED YOU WORTHLESS PIECE OF BUDONG DREN!). Or someone's going to install a new version of tcsh which has spiffy new aliases which live in ~/.tcshrc and . . .

It's a much saner solution to say, "Zsh, bash, and ksh let you provide a subprocess' output as input to another command like so. If you don't use one of those shells, keep using tempoary files like you've always done; may I also welcome you to the 21st century, and I'd like to apologize if you're personally offended by those insurance commerials.