Linked Questions
43 questions linked to/from What is the difference between sourcing ('.' or 'source') and executing a file in bash?
20
votes
5
answers
2k
views
Difference between ". myscript" and "./myscript" [duplicate]
I am confused by "one only dot - space - shell script name" (like . myshellscript) and "path to shell script" (like ./myshellscript) commands.
What for they are? I noticed the command . myshellscript ...
15
votes
4
answers
3k
views
What is the difference between '$ . foo' and '$ ./foo'? [duplicate]
t is a simple script
What is different between two case below :
$ . t
and
$ ./t
8
votes
1
answer
16k
views
What is the difference between "." "./" and "source"? [duplicate]
What is the difference between
. script.sh
./script.sh
and
source script.sh
?
6
votes
1
answer
13k
views
How to export an environment variable from .sh file in zsh? [duplicate]
I have the following shell script
TEST=/foopath
export TEST
It is in a file called test.sh and on which I ran chmod +x test.sh
When I run ./test.sh I expect that I can then execute echo $TEST and ...
0
votes
2
answers
5k
views
What does dot mean in this command? [duplicate]
According to the Flask official tutorial:
Now, whenever you want to work on a project, you only have to activate
the corresponding environment. On OS X and Linux, do the following:
$ . venv/bin/...
2
votes
3
answers
2k
views
What is the difference between ./script and . ./script? [duplicate]
Possible Duplicate:
Using ‘.’ to execute files in bash
I was trying to figure out how to export my environmental via script instead of changing my .bashrc file.
I found this old useful post that ...
5
votes
1
answer
875
views
Whys is there extra dot at the start of some command I'm supposed to execute [duplicate]
I've downloaded an installation package of weblogic server and in the README, there's this command to execute:
Linux/Mac
$ . ./configure.sh
It's not the first time I see this. Why is there an extra ...
0
votes
3
answers
854
views
bash script not creating alias and not updating $PS1 [duplicate]
I thought I will write a bash script to set the alias I frequently use, and also to change the command promt.
Below is my script.
#!/bin/bash
# Make useful aliases
alias c='clear'
alias p='pwd'
...
1
vote
2
answers
3k
views
'export'ing a variable in shell script [duplicate]
We have two scripts, first.sh and second.sh. We run first.sh from second.sh using the . (source) command.
I am stuck at this script,
first.sh
value="myvalue"
export value
oldvalue="othervalue"
...
3
votes
1
answer
643
views
use of . in bash [duplicate]
#!/usr/bin/env bash
scriptdir="$HOME"
touch $scriptdir/foo.txt
. "$scriptdir/foo.txt" ||
{ echo "Missing '$scriptdir/foo.txt'. Exiting." ;
exit 1 ;}
echo "$scriptdir/foo.txt is present"
echo
rm "$...
-1
votes
1
answer
2k
views
How to properly write and execute a shell script and exit correctly? [duplicate]
I have written a shell script named startup.sh which does a lot of things (basically start a lot of things for me after turning on my local machine) - here is an excerpt:
#!/bin/bash
gnome-terminal --...
3
votes
1
answer
388
views
Difference between "." and "./" while setting the environment variables using export? [duplicate]
Please excuse me if I am not clear while asking questions. I will try my best to be very clear while asking questions.
While learning Embedded Linux, we are setting an environment for our project. ...
1
vote
1
answer
964
views
Script called by .bashrc with "exit" prevents log-in [duplicate]
I caught myself out; I couldn't log into root after I made a script and called it from ~/.bashrc.
~/.bashrc:
#... do stuff then run my script
source ~/myscript.sh
~/myscript.sh:
#!/bin/bash
if [...
1
vote
1
answer
1k
views
Command output evaluation not working in Bash script [duplicate]
I am trying to automate adding Homebrew to my path in a shell script, but these two lines do not evaluate inside my shell script:
#!/bin/sh
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)&...
0
votes
2
answers
356
views
Env variables failed to load in bash [duplicate]
I want to export all the variables located in a .conf. So I followed this https://unix.stackexchange.com/a/79077/56901 answer.
setenv.sh
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}...