0

Please help in knowing what is the usage of . in Unix scripting.

For example:

. /apps/Infor_shar/PSSRT/PSHUP/prsm/psnp_env
Kusalananda
  • 333,661

1 Answers1

0

The dot command (.) is a command that runs the shell script given on its command line (sometimes called a "dot-script") in the current shell's environment. This means that any variable assignment, function declaration, change of the current working directory, or other changes to the given script's environment, will stay visible once the script has finished running.

Since the script is executed by the current shell, a #!-line at the start of such a script will be ignored.

In some shells, the standard . command is aliased to a source command.

Kusalananda
  • 333,661
  • Just to add more clarity: normally when you execute a command, the command runs in a separate process as a child of the current shell. The dot-script allows you to execute in the current shell instead of a subshell. Dot-scripts normally have commands that alter the environment somehow as in the example your post - psnp_env. – floydn Feb 08 '23 at 21:42