![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Background execution of a script | Cameron | Shell Programming and Scripting | 2 | 10-03-2007 02:50 AM |
| error during the execution of script | surjyap | Shell Programming and Scripting | 1 | 08-24-2007 05:10 PM |
| Pb with script execution and variables | Cecile | AIX | 1 | 09-15-2006 06:54 AM |
| Script execution information | manthasirisha | Shell Programming and Scripting | 12 | 07-07-2006 05:54 AM |
| execution of shell script | malaymaru | Shell Programming and Scripting | 5 | 06-13-2005 06:49 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
pb with script execution
Hello,
Can somebody tell me the differnce between a call of a ksh with the dot : >. script.ksh and the call without the dot: >script.ksh In my script I have writen a test for the number of parameters: if [ $# -ne 0 ] then echo 'Usage : '$0 exit 1 fi as my script doesn't need any parameter if I call like this: >. script.ksh $# = $0 = -ksh which is wrong I can't do a correct test of my parameters, but if I remove the parameter test I can give value to variables, and these variables are known and have a value in my parent shell and can be used by other scripts If I call like this: >script.ksh $# = 0 $0 = script.ksh which is OK, but I want to export variables that must be used in other script and my variables remains unknown in my parent shell but it seems that I can execute other script that can see the variables.... I don't understand anything.... see you Cécile |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
When you run a script as ". ./scriptname", the script executes in the context of the current shell. All your shell variables (such as $0, $#, etc) will also be those of the current shell. So showing $0 to be -ksh is what should happen.
Since the script that you are using is basically to setup env. variables, don't check for things like $0, just export your variables and be done with it. |
|
#3
|
|||
|
|||
|
pb with script execution
Thank you for your answer.
I understand a little bit more. If a call with the dot I stay in the parent shell ? In fact I don't really execute the script but I read it?? Do I execute another shell when I call a script with the dot ? You 're right I don't need to check parameters here. Ok, it works when I call like that : . Script1.ksh . Script2.ksh |
|
#4
|
|||
|
|||
|
Quote:
Quote:
|
|||
| Google The UNIX and Linux Forums |