Not to confuse the issue... But this is my understanding.
Quote:
1) . ./filename
2) ./filename
1) The dot with a space tells the shell to source the file. The dot slash tells the shell the file is in the current directory.
Example. You have two script files. One called "run" the other called funct.
Your funct file would look something like this.
Your run file would look something like this.
When you execute run it will source the fuctions into the current shell. Then you simply call the function from within your script. This is most useful for common functions used in many scripts. You need only type the functions in once when creating the funct file. Then you source in the functions in any other script you need them in. This can also be used from the command line to source functions into your current shell. You can then use these fuctions as if they were commands.
2) Simply tells the shell to execute the file in the current directory. Mostly used when the directory your in is not in your PATH, or there are mutiple prgrams with the same name (Bad Idea) and you want to run the instance in the current directory.
1)./ means you have file in your current directory and from where you want to use.
2).<space>filename means you want to run the file in the current shell.The . command executes a script without using a subshell.it also doesn't require the script to have executable permission.
the use of this is to keep some function in file and run that file as
. filename then u can use those functions in a command line directly as you use commands.
one more use is to modify .profile file and you want to reflect changes without rebooting run the command
.<space> .profile
Hi,
I am new to UNIX and want to execute oracle script from unix script.
I have written below script but i am getting below error.
#!/bin/bash
file="/home/usr/control/control_file1"
while read line
do
#$line=@$line
#echo $line
sqlplus tiger/scott@DB
@$line
exit
#echo "$line"
done... (3 Replies)
Hi Team,
a silly question.
Let's say i have a script called xyz.ksh
what is the difference in executing the script as follows?
./xyz.ksh
ksh xyz.ksh
Thanks (2 Replies)
Hi i wrote a script which dosent exists after executing any help
#!/bin/bash
netstat -ptlen | grep 10000
if ; then
echo "Hive Thrift server is running"
exit 0
else
echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com
`nohup hive... (7 Replies)
Hi ,
What is the diffence between executing the script like
./myscript.ksh
. ./myscript.ksh
I have found 2 difference but could not find the reason
1. If i export a variable in myscript.ksh and execute it like . ./myscript.ksh the i can access the other scripts that are present in... (5 Replies)
Hi Guys,
Hope you are doing well out there.
Can you please let me know why do we use "./" to run a shell script?
Is it to run the script in the current shell or something else?
What if I have already defined a bang in the script say #!/bin/ksh and then running the script as... (2 Replies)
Hi,
I have a script get_DB_var.ksh which do a data base call and get some variables as below:
sqlplus -silent $user/$pass@dbname <<END
select col1,
col2,
col3
from table_name where col4=$1;
exit;
END
Now I want to access all these variables i.e.... (9 Replies)
Hi All,
I know this has been discussed a lot but still I need some more answers. I am running this is ksh on AIX 5.3
I believe putting a "." in front of the script will start a new shell, is that correct??
I have a script which override some PATH variables and it does not do that... (3 Replies)
I need to execute a shell script kept in unix machine from windows. User id, password area available.
For eg.
There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS.
Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Hi ,
Kindly advice whats wrong with this script. It is not executing.
...#
#!/bin/ksh
find. -name "b.log"
if ; then
echo "1"
fi
...#
Thanks (5 Replies)
Is there any difference in executing the shell using sh and . and ./.
I had a shell script and i observed that anyone is ale to execute the script eith sh even without having the execute permission.how is so? (2 Replies)