Using a point in a bash script

What does the dot on line 8 of the next code snippet mean from the source /etc/profilein the Mac OS X Mavericks terminal.

  1 # System-wide .profile for sh(1)
  2 
  3 if [ -x /usr/libexec/path_helper ]; then
  4         eval `/usr/libexec/path_helper -s`
  5 fi
  6 
  7 if [ "${BASH-no}" != "no" ]; then
  8         [ -r /etc/bashrc ] && . /etc/bashrc
  9 fi
+4
source share
2 answers

In bash, .this is another way to spell source. So this line is the same:

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
        [ -r /etc/bashrc ] && source /etc/bashrc
fi

sourceinterprets the file as if the contents were included in the command location source. The difference with doing this is that it can set aliasor define functionor variables.

+4
source

According to Bash HOWTO Request :

( . filename ), , . , , .

+2

Source: https://habr.com/ru/post/1536606/


All Articles