![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| significance of statement | nickcarter | UNIX for Dummies Questions & Answers | 3 | 02-19-2008 09:48 AM |
| what is the significance of braces and spaces??? | ahmedwaseem2000 | Shell Programming and Scripting | 3 | 09-03-2006 09:41 PM |
| what the significance of ~ | BigTool4u2 | UNIX for Dummies Questions & Answers | 2 | 04-22-2004 09:56 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I have script named test.ksh under /tmp directory. Code:
ls -l test.ksh -rwx------ 1 enaggan inmalogin 30 Jul 16 11:59 test.ksh I have execute permisson on it. Case 1: I am trying to run the above script by, cd /tmp test.ksh ksh: test.ksh: not found This doesnot work as we have not added the path /tmp to the PATH varible. Case 2: I am trying to run the above script by, cd /tmp ./test.ksh Hello World To run a script that is not present in any of the directories in the PATH variable,we have to explicitly state path of the script. i.e Either the full path or relative path. Eg: /tmp/test.ksh or ./test.ksh Case 3: In case of we don't execute permisson on the script, We can pass the name of the script as an argument to ksh. Example: ksh test.ksh Hello World Code:
cat /tmp/test.ksh #!/bin/ksh echo "Hello World" Hope this clarifies. Thanks Nagarajan Ganesan |
|
||||
|
well, basically when you source a file like this you are running it in the
context of the current shell. simply put, if you do . script you are not running it, you are including it line by line, sort of. So if you do it from the command line it's as if you have typed the script in manually so all variables, functions etc. will remain once the process is over. it is generally a way of importing variables functions etc into the current environment or context whatever you like to call it. a script run normally will do it's own thing without affecting the current script or environment. if you get what i mean. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|