bash trick - prefixing a command?

Rodolfo Alcazar rodolfo.alcazar at padep.org.bo
Tue Oct 25 18:12:53 UTC 2005


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"
> 
> Is there a way to do that? Basically I want to use bash as transparent 
> front end for another program (actually a command parser for some custom 
> hardware), while keeping the handy editing and history abilities of bash.

Yes. Check this ls capturing for hiding some file (grep -v filters
pattern):

[rodolfoap] /home/rodolfoap/test > ls

test_one  test_three  test_two

[rodolfoap] /home/rodolfoap/test > function ls() { /bin/ls|grep -v two; }

[rodolfoap] /home/rodolfoap/test > ls

test_one

test_three

[rodolfoap] /home/rodolfoap/test >

--
Rodolfo Alcazar - rodolfo.alcazar at padep.org.bo
Netzmanager Padep, GTZ
591-70656800, -22417628, LA PAZ, BOLIVIA
http://otbits.blogspot.com
--
The value of a program is inversely proportional to the weight of its
output.






More information about the fedora-list mailing list