Re: bash trick - prefixing a command?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2005-10-25 at 12:17, 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"
> >>
> > I think what yo want to do would be a command alias.  Generally, these are  
> > setup in either the /etc/profile or in the individual users .bash_profile 
> 
> 
> No, I don't think an alias would work - the argument isn't known ahead 
> of time, so you can't define an alias.

There are a finite number of commands that can be found by
searching your $PATH.  Alias them all...  Or adjust the $PATH
so that a directory containing all the possible program names
symlinked to your program comes first.  The program can look
at the command line you entered to decide what to do next.  
Of course these won't work if the user types the full
path to the command.

-- 
   Les Mikesell
     lesmikesell@xxxxxxxxx



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux