scripting help

Posted on 2001-09-12
Last Modified: 2013-12-27

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.?

Question by:msnr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 40

Expert Comment

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).
LVL 51

Accepted Solution

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

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 $*

Expert Comment

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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI


Expert Comment

ID: 6535996

Expert Comment

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

Expert Comment

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.
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.

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.

To view your locked questions, please click the following link(s) and evaluate the proposed answer.

------------>  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

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.
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.

Expert Comment

ID: 6973279
Comment from expert accepted as answer.

E-E Moderator

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

615 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