Export keyword in BASH scripting

I am trying to install PETSc on my Ubuntu laptop. The first step in the installation is to call the following commands in the top-level directory of the PETSc directory in the terminal.

export PETSC_DIR=$PWD
./config/configure.py --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack=1 --download-mpich=1
make all test

Question 1: Should I really enter the word "PWD" or the address of the top-level directory of PETSc?

Question 2: What I wanted to understand is that the export keyword does in general, and in particular, what it does in this example. I looked at some links to the export keyword, and all of them did not really explain clearly. I was probably looking for the wrong place.

I have never done any shell scripts, so a detailed answer would be very helpful ... Thank you so much!

+3
source share
1

export .

, PETSc. , $PWD ( ) - , . :

[jm72@localhost PETSc_1_1_1_1]$ pwd
/home/jm72/soft/PETSc_1_1_1_1
[jm72@localhost PETSc_1_1_1_1]$ export PETSC_DIR=$PWD
[jm72@localhost PETSc_1_1_1_1]$ echo $PETSC_DIR
/home/jm72/soft/PETSc_1_1_1_1
[jm72@localhost PETSc_1_1_1_1]$ export PETSC_DIR=/home/jm72/soft/PETSC_1_1_1_1
[jm72@localhost PETSc_1_1_1_1]$ echo $PETSC_DIR
/home/jm72/soft/PETSC_1_1_1_1
+5

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


All Articles