I have script named test.ksh under /tmp directory.
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.
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.
I can relate to what you are trying to explain, as I've applied the same practically without knowing what is actually being done. Its very clear. Thanks for your explanation!
I'm taking a LINUX and UNIX class and we are using bash as the shell in terminal. On my mac-book I use zsh only because my professor had a pretty cool start-up file for it.
It has benefited me in becoming familiar with different shells. However, I'm having a hard time understanding the purpose... (4 Replies)
What is the significance of the forward slash(/) while specifying a directory?
cp -av /dir/ /opt/
and
cp -av /dir /opt
Does effectively the same job it seems? (2 Replies)
Hello... I am getting ready to create a bunch of groups for several of our servers all of which are running Aix 5.3. We really want to keep people away from using the root login and as such the systems have been hardened using aixpert and if it is absolutely needed people must su -.
There are... (1 Reply)
this post is related to the arrangements of libraries in a solaris-8 distribution.
i want to build external packages on solaris-8
i need to know why libraries are scattered in a solaris distribution among different below mentioned directories,
please tell me whats the importance ??
/lib... (3 Replies)
Hi,
I am a newbie in unix shell scripting and I am trying to understand the result of the following line :
ls -l $1*$4*ready
I understand the ls-l but the rest is just really confusing. Any help would be appreciated.
TIA (3 Replies)
Hi ,
i have few doubts about the braces and spaces which are quite often used:
for instance:
when i try the belo command it will not work
export variable= cat filename
rather when i try the cat command without any space it works fine
export variable=cat filename
and... (3 Replies)
what does this symbol ~ represent in unix for example....
If i create directories called personal and lab and lab5 and the command chmod 776~/lab5 is issued. What results would i expect to get. basically i know that chmod 776 would prevent others from executing the files in the directory but... (2 Replies)