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.


In reply to Re^3: spawning shell commands with aliases by Fletch
in thread spawning shell commands with aliases by xafwodahs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.