Solved

scripting help

Posted on 2001-09-12
7
219 Views
Last Modified: 2013-12-27
HI,

I have a directory in which 100 applications are there.
ex: cd /usr/tools

users will call those applications giving full path to them.
ex: /usr/tools/frame

i want to execute a script before the application invokes for all those 100 applications.
i mean, whenever users say  /usr/tools/frame
or /usr/tools/app2 or /usr/tools/app3..etc

i want to execute a common script which will inturn call the application .

i can create soft links to 100 applications, but
can i do it any otherway..

my main idea is, whenever users call any application in /usr/tools directory
i want to execute a script instead of the application.


can i.?


msnr
0
Comment
Question by:msnr
7 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 6476460
If the users will be using the full path to each of the tools, then creating a symlink for each application is going to be the only way. The only alternative would be if you could have the users execute your script with the application name as an argument (i.e., /usr/tools/launcher frame).
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 85 total points
ID: 6477645
move your apps down to a subdir, like in a csh:

  cd /usr/tools
  foreach f (*)
  mkdir wrapped && mv $f wrapped
  ln -s wrapper $f
  done

then build a wrapper (/usr/tools/wrapper) like:


  #! /bin/csh -f
  set mep = "$0"
  set me  = $mep:t
  set cmd = `echo "$0"|sed -e 's#'#"$me"'#wrapped/&#'`
  # do what you want
  $cmd $*
0
 
LVL 1

Expert Comment

by:bearware
ID: 6535954
There may be a vertual file system you can use. That sits on /usr/tools. and when a program /usr/tools/bla is run actualy runs wraper /user/tools-hidden/bla
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 1

Expert Comment

by:bearware
ID: 6535996
0
 
LVL 1

Expert Comment

by:bearware
ID: 6535998
There may be a vertual file system you can use. That sits on /usr/tools. and when a program /usr/tools/bla is run actualy runs wraper /user/tools-hidden/bla
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6878625
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.11745262.html
http://www.experts-exchange.com/questions/Q.11746658.html
http://www.experts-exchange.com/questions/Q.11795198.html
http://www.experts-exchange.com/questions/Q.20108943.html
http://www.experts-exchange.com/questions/Q.20110009.html
http://www.experts-exchange.com/questions/Q.20118853.html
http://www.experts-exchange.com/questions/Q.20118933.html
http://www.experts-exchange.com/questions/Q.20122649.html
http://www.experts-exchange.com/questions/Q.20128151.html
http://www.experts-exchange.com/questions/Q.20128355.html
http://www.experts-exchange.com/questions/Q.20164478.html
http://www.experts-exchange.com/questions/Q.20174299.html
http://www.experts-exchange.com/questions/Q.20177750.html
http://www.experts-exchange.com/questions/Q.20181801.html
http://www.experts-exchange.com/questions/Q.20182702.html
http://www.experts-exchange.com/questions/Q.20193715.html
http://www.experts-exchange.com/questions/Q.20226694.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.11409318.html
http://www.experts-exchange.com/questions/Q.11451558.html
http://www.experts-exchange.com/questions/Q.11451598.html
http://www.experts-exchange.com/questions/Q.11452958.html
http://www.experts-exchange.com/questions/Q.11453159.html
http://www.experts-exchange.com/questions/Q.11794978.html
http://www.experts-exchange.com/questions/Q.20125858.html
http://www.experts-exchange.com/questions/Q.20181913.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6973279
Comment from expert accepted as answer.

Computer101
E-E Moderator
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now