![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calling expect scripts from other expect scripts | seva | Shell Programming and Scripting | 0 | 04-03-2008 10:45 AM |
| FTP Scripts | raghav1982 | Shell Programming and Scripting | 27 | 12-07-2007 03:38 AM |
| use of ssh in scripts | esham | Shell Programming and Scripting | 7 | 11-16-2005 08:27 AM |
| Help with GDL to SQL scripts | ch4r1e5 | Shell Programming and Scripting | 0 | 10-31-2005 02:51 PM |
| using su in scripts | uchachra | UNIX for Dummies Questions & Answers | 3 | 03-11-2002 10:24 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
To run scripts
How to run a script from any directory?
Should i include any environment or wat should i start with in writing a script ? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Without assuming completeness:
- make all the paths inside the script absolute. "/x/y/z" will always refer to the same place, "./a/b/c" will not - set the environment explicitly. You might not need that for scripts run from the commandline, but once you put the script into cron the environment is different (in this case: non-existent). Scripts which "work" on the commandline but not from cron because of this make a good part of the problems in "Shell Programming and Scripting" forum. If you want a truly encapsulated solution you can use an external shell function for the environment and put this function into a "library". Analogous to the "PATH" variable there is a "FPATH" variable which can be set to a list of directories. It tells the shell where to search for external functions. - all the rules of software engineering apply. Just because it is a script language does not exempt you from the necessity to document, encapsulate, strucurize, .... your code. If you wouldn't do it in a high-level language you shouldn't do it in a script either. I hope this helps. bakunin |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|