help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] ?????? Hi, Could you help me to solve a bash problem?


From: Greg Wooledge
Subject: Re: [Help-bash] ?????? Hi, Could you help me to solve a bash problem?
Date: Wed, 26 Mar 2014 10:02:58 -0400
User-agent: Mutt/1.4.2.3i

On Wed, Mar 26, 2014 at 09:54:55PM +0800, MD5Ryan wrote:
> oh...maybe i misunderstand you reply... emmm... i mean that i have a
> whitelist includes some commands, if user typed a command in this whitelist
> then run normaly, if not, i will use my program trace it(just like
> strace...). for example, command "badcommand" is not in whitelist, if user
> typed this command in bash, the command will be traced, like run "strace
> badcommand"(add strace auto, instead of run ??baccommand?? only)...

Where is the user typing these commands?  In a bash login shell?  Or in
a script that you wrote which does its own prompting and reading?

What if the user types a pipeline?  If the user types "a|b" would you
run "strace a | strace b"?  Or would you only strace the first command
in the pipeline?

What if the user types a pipeline which contains a while loop which
contains multiple pipelines inside it?  And if statements, and case
statements, and [[ ... ]] commands with && embedded inside them, and
process substitutions, and so on.

If you are expected to handle all of these, then you need something
which can handle the complete bash syntax, which is a very difficult
thing to do.  At that point, it might be EASIER to modify bash at the
source level than to attempt any other solution.  Assuming of course
that the answer to the first question is "The user is typing in a login
shell which the user believes is bash because I FOOLED HIM!!"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]