Solved

scripting help

Posted on 2001-09-12
7
224 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
[X]
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
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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.:
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…

751 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