Linked Questions
15 questions linked to/from Different ways to execute a shell script
9
votes
1
answer
51k
views
Setting up environment variables with .sh file [duplicate]
I have created env.sh file the contents of which are below
#!/bin/sh
export M2_HOME=/vagrant/tools/maven
export PATH=$PATH:$M2_HOME/bin
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
export ANT_HOME=/usr/...
9
votes
1
answer
19k
views
What does sourcing a file mean in a shell? [duplicate]
Possible Duplicate:
Different ways to execute a shell script
What happens when I issue the following command:
source devenv.csh
How does it differ from running it just as devenv.csh ?
3
votes
4
answers
2k
views
Is there a difference between ./script and bash script? [duplicate]
Given a shell script file that begins as
#!/bin/bash
# (bash script here),
and has been chmod +xed, is there any difference in running ./script and bash script from the command-line?
5
votes
2
answers
201
views
. /path/to/a/shell-script-file ? (within a shell script) [duplicate]
What does . /path/to/a/shell-script-file
do exactly? I mean obviously it executes that shell script but why put that . followed by a space before the path/name of the script file?
2
votes
1
answer
3k
views
How to execute something in current shell [duplicate]
I want to create a bash script or something similar that I can execute in the current shell:
echo '#!/bin/bash
export foo="bar" ' > zoom.sh
but if I want to run this script in the current ...
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
2
answers
220
views
what condition we need to use "." in command line? [duplicate]
a question -
in some case, I saw command line like this
. ./test.sh
I'm curious why use "." before "./test.sh"
what condition we have to use "." before a command?
2
votes
1
answer
414
views
Difference between 3 commands which are used to execute shell script? [duplicate]
Possible Duplicate:
Different ways to execute a shell script
What are the specific differences between the commands listed below?
./<scriptname>
. <scriptname>
bash <scriptname>...
-1
votes
1
answer
377
views
To execute a shell script: Using "zsh script.sh" and using "./script.sh" [duplicate]
To execute a random shell script, e.g. script.sh that contains only a single line echo 'foo', I can use zsh script.sh, and this works. But if I try to execute the same file using the dot syntax ...
-2
votes
1
answer
98
views
Sourcing works manually but fails when done from script [duplicate]
Using curl as in:
bash <(curl -s https://raw.githubusercontent.com/user/repo/master/script.sh | tr -d '\r')
I executed some remote script.
The remote script includes the following two aspects:
1)...
51
votes
5
answers
50k
views
Is it possible to include file in config file of zsh? How?
I'd like to have a file eg. f with only zsh aliases (pureness reasons). Then I'd like to include f file in my .zshrc file, so that the aliases defined in f are visible in .zshrc.
Is it possible?
If ...
7
votes
3
answers
11k
views
Invoking pushd in a shell script
I have a simple script that I want to invoke 'pushed' followed by another command. But the 'pushd' command inside the script doesn't seem to stick past the script.
What's a way to make this execute ...
4
votes
3
answers
6k
views
Executing of all shell scripts in a directory starting with the letter 'a'
I have many shell scripts in a directory starting with letter 'a'. How could I execute all of those shell scripts at a shot? Can we develop any other small script to run this?
0
votes
2
answers
6k
views
Different ways to execute a binary? [closed]
Are there more ways of executing Unix binaries using a terminal (command line)? Using echo as an example:
$ /bin/echo "test"
test
$ cd /bin/
$ ./echo "test"
test
$ eval echo "test"
test
0
votes
1
answer
505
views
Difference between ways in script execution
I would like to ask you the differences between the following ways in script execution.
. script.sh
../script.sh
. ./script.sh
Thank you in advance.