Is there a way, ideally in bash, but if not in another shell, to put perl between hitting enter after you have entered a command and before the shell does all its quoting and magic? Basically a way to pre-process the command before bash reads it and do things like change
s dave when you use $foo and " it interpolates #to s dave when\ you\ use\ \$foo\ and\ \"\ it\ interploates #basically s/^(s\s+\S+\s+)(.*)/$1\Q$2\E/;
so that any any s command the text after the name get shell quoted? I hope that is clear enough...

The idea is s is a system messager, and due to the shell if you misquote " or $ it can screw you up... but I know I always want them quoted for that particular command...

                - Ant
                - Some of my best work - Fish Dinner


In reply to Command line preprocessing by suaveant

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.