bash trick - prefixing a command?
rrmalloy at comcast.net
rrmalloy at comcast.net
Tue Oct 25 18:32:47 UTC 2005
> Rodolfo Alcazar wrote:
> > On Tue, 2005-10-25 at 13:00 -0400, Dr. Michael J. Chudobiak wrote:
> >> I want to do some shell trickery so that when a user enters a command like:
> >>
> >> ls -l
> >>
> >> the command is forwarded to another program as an argument. That is,
> >> what actually gets executed is:
> >>
> >> myprog "ls -l"
> >
> >
> > [rodolfoap] /home/rodolfoap/test > function ls() { /bin/ls|grep -v two; }
>
>
> Thanks, that is a neat trick that I wasn't aware of, but "ls -l" was
> just an example of one possible input. I want to forward every command
> to my own program, not just "ls" commands.
>
> An alias feature with wildcards or regular expressions (on the _left_
> side of the alias definition) would do it, but bash doesn't have that
> particular feature.
>
>
> - Mike
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Have you looked at the GNU readline library?
It may give you enough command line editing and history features
for you purpose.
Rich
More information about the fedora-list
mailing list