![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| executing script by cron doesnt give me expected result | anchal_khare | UNIX for Advanced & Expert Users | 1 | 09-12-2007 08:07 AM |
| executing a SQL query in shell script | lijju.mathew | Shell Programming and Scripting | 1 | 05-17-2007 11:29 AM |
| Executing a Shell Script | igandu | UNIX for Dummies Questions & Answers | 4 | 08-17-2006 10:29 AM |
| Shell script is not executing | dreams5617 | UNIX for Advanced & Expert Users | 5 | 08-20-2004 11:45 AM |
| Executing shell script with xp_cmdshell | gerald_agoi | UNIX for Advanced & Expert Users | 2 | 10-10-2001 04:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
executing shell script from the cron
This isn't the usual problem that a shell script runs from the command line and not the cron. It's a little different.
Among other things, the shell scrip executes my .profile to set a bunch of variables. It then does an env to ensure that it ran OK. There are echos in the shell script and the .profile. All this gets logged. The shell script (simplified) looks like this: echo Start of shell script echo . . . /home/me/.profile echo Results of env = env echo echo End of shell script The log (simplified) looks like this: Start of shell script ----------- (these echos are from the .profile) profile started variables a b c x y z set a=yes b=yes c=yes x=yes y=yes z=yes profile ended ------------------------ Results of env = a=no b=yes c=no -------- end of shell script I can see from the log that it is executing the correct .profile, however, the variables set in the .profile aren't "retained". If I change the command to : . /home/me/.profile ^ Note: added . space everthing runs fine. So what's does the . space do that makes it work? |
|
||||
|
sourcing a file
NORM,
. file is known as sourcing a file. It will pull any env settings, or variables set within the file into the current shell. [ Normal behaviour is for a child process to inherit from a parent, not the other way around, which is why you lost your settings previously] steve |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|