Skip to main content
Changed title to something easier to find
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719

Using ' What is the difference between sourcing ('.' to execute filesor 'source') and executing a file in bash?

What's the difference between executing a script like this:

./test.sh

and executing a script like this:

. test.sh?

I tried a simple, two-line script to see if I could find if there was a difference:

#!/bin/bash
ls

But both . test.sh and ./test.sh returned the same information.

Thanks.

Using '.' to execute files in bash

What's the difference between executing a script like this:

./test.sh

and executing a script like this:

. test.sh?

I tried a simple, two-line script to see if I could find if there was a difference:

#!/bin/bash
ls

But both . test.sh and ./test.sh returned the same information.

Thanks.

What is the difference between sourcing ('.' or 'source') and executing a file in bash?

What's the difference between executing a script like this:

./test.sh

and executing a script like this:

. test.sh?

I tried a simple, two-line script to see if I could find if there was a difference:

#!/bin/bash
ls

But both . test.sh and ./test.sh returned the same information.

Tweeted twitter.com/#!/StackUnix/status/227940021477462016
Source Link
Nathan
  • 1.3k
  • 2
  • 9
  • 10

Using '.' to execute files in bash

What's the difference between executing a script like this:

./test.sh

and executing a script like this:

. test.sh?

I tried a simple, two-line script to see if I could find if there was a difference:

#!/bin/bash
ls

But both . test.sh and ./test.sh returned the same information.

Thanks.