The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: How to....
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-27-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
The current script's name is in $0 but it only basically tells you the path the user typed in (or how some tool resolved it), not necessarily the full path.

If your dependent script wants to load a library from a particular directory, you need to hard-code the path, or employ some heuristics to divine how you were invoked. $0 can be helpful but if the script is on the user's PATH then you need to start guessing. Perhaps the simplest solution is to require the user to set an environment variable to tell where the library can be found, or always run the script in a particular directory (yeah, not very elegant).

Generally you don't want web visitors to be able to start programs on your desktop. Some web-facing programs go to great lengths to get an X11 client into a position where it can be driven by a CGI script and not get stuck, and under no circumstances be able to touch the local file system or other local resources. But if you are okay with the possible consequences, the main hurdle is probably getting xauth etc torn down to the point where your X11 is completely insecure, so that another user can start programs on your display. It may not really require more than xhost +localhost (after you put your helmet and your rubber gloves on).

(Or do you mean "desktop computer" rather than "graphical session"?)

Last edited by era; 04-27-2008 at 06:57 PM.. Reason: On enabling X11 from the web