473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Can i know who has issued a comand?

Hi all

I want to implement some functionality in rm command. But i want this
functionality to be there only when the user has inetractively issued
the command on the prompt.

For example : The added functiona should not get invoked when some
Kernel / or User script ,or Some package's ./configure or make clean
command is called.
This extra functinality should be called only when rm is issued by user
on CLI. Morover i need to hookup that rm command. i.e My function
should be called before rm perfroms the deletion.

I have tried the option of making changes to rm code itself , or making
alias entries in .bashrc file.

Is there any other way?

Please guide.

Regards
Sumit Chawla("eNetra")
Slogan:"Hail The Invention"

Nov 15 '05 #1
3 1288
In article <11**********************@g43g2000cwa.googlegroups .com>,
Sumit Chawla <en****@gmail.com> wrote:
I want to implement some functionality in rm command. But i want this
functionality to be there only when the user has inetractively issued
the command on the prompt.
That is not a C topic, that is a topic specific to your OS
(which you still haven't mentioned, even though I hinted about this
point before.)

For example : The added functiona should not get invoked when some
Kernel / or User script ,or Some package's ./configure or make clean
command is called.
This extra functinality should be called only when rm is issued by user
on CLI. Morover i need to hookup that rm command. i.e My function
should be called before rm perfroms the deletion.
Let me see if I have this straight:

$ rm /tmp/foo # invoke extra functionality
$ sh <<EOF
rm /tmp/foo
EOF # do not invoke extra, this is a script
$ sh -c "rm /tmp/foo" # do not invoke extra, this is script
$ ( rm /tmp/foo ) # this is a mini-script too, so no extra functionality
$ touch /tmp/foo; rm /tmp/foo # I'd say this is a script
$ \rm /tmp/foo # not a script, invoke extra thou aliases disabled
$ /bin/rm /tmp/foo # not a script, invoke extra though real rm called direct

$ sh
$ # we are in an inner shell here
$ rm /tmp/foo # is this a script or is this interactive ?
$ exit
$ # back to original shell

I have tried the option of making changes to rm code itself , or making
alias entries in .bashrc file. Is there any other way?


My personal opinion: give it up as a bad idea.
--
Entropy is the logarithm of probability -- Boltzmann
Nov 15 '05 #2
Sumit Chawla wrote:
Hi all

I want to implement some functionality in rm command. But i want this
functionality to be there only when the user has inetractively issued
the command on the prompt.

For example : The added functiona should not get invoked when some
Kernel / or User script ,or Some package's ./configure or make clean
command is called.
This extra functinality should be called only when rm is issued by user
on CLI. Morover i need to hookup that rm command. i.e My function
should be called before rm perfroms the deletion.

I have tried the option of making changes to rm code itself , or making
alias entries in .bashrc file.
Dont try making any change to the rm code. You will surely break
something and how would you ensure that the target machine also gets
the rm code modified. If I were one of your target users and you would
come telling me that you need to modify rm code at my machine, I would
rather not use that product of yours.

Is there any other way?

Please guide.

Regards
Sumit Chawla("eNetra")
Slogan:"Hail The Invention"


Again an OT here. Go look for unix specific newsgroups.

Nov 15 '05 #3
"Sumit Chawla" <en****@gmail.com> writes:
I want to implement some functionality in rm command. But i want this
functionality to be there only when the user has inetractively issued
the command on the prompt.


[...]

This is off-topic in comp.lang.c.

However, it's an appropriate question for comp.unix.shell. I see that
you posted the same question there almost simultaneously (and I've
responded there).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jesper | last post by:
Hi, I would like to issue three statements to the database (mysql v4.1) each time the server starts up. Is there any built in way to do this? Like a init file to put them in? At the moment I...
2
by: Herbert | last post by:
Hallo colleques, I get during the following error message "SQL1035N No database manager command was issued. SQLSTATE=57019", when issuing the following command on the Command Line Processor:...
3
by: alan_sec | last post by:
Hi everybody, i need some help please. I have installed DB2 UDB 7.2 on Windows and created database and it worked fine (i could access it from control centar nad using eclipse plug-in...
3
by: CSharpUser | last post by:
How do I pass in command line parameters to the program at startup in Visual Studio. This is similar to doing csc program arg1 arg2. I want to achieve the same effect running the program in...
6
by: Peter Row | last post by:
Hi, I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response redirect or not. Specifically I need to know...
3
by: Howard | last post by:
Help, How Do I diplay '&' as text on a comand Button !
16
by: RichardP | last post by:
Hi there everyone - I'm new to this forum. I am having an issue when running an application from an instance of Access which has been started through automation (early or late bound, makes no...
4
by: jx2 | last post by:
can any1 give me a good example for cli or CGI or comand line usage i've read the description on php.net but i just dont understand whats going on what do you use it for and how - i managed to run...
4
by: db2dbdba | last post by:
Hi All, How can I check for when a db2stop command is last issued? Or when a db2 force applications all command is last issued? Thanks in advance R
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.