Assigning Variables

Hi,

Can the below be clarified please. i just want to know what is the difference between the two ways of assigning variables as mentioned below.

 
export SRC_TBL=${SRC_TBL-"MMA_COPAY_PLN_FACT_STG"}
export SRC_TBL="MMA_COPAY_PLN_FACT_STG"

thanks in advance :slight_smile:

Arun

The first means:

The second is a regular variable assignment. The quotes are not necessary:

Both variables are exported.

To give an example:

$ echo "$var"

$ var=${var-foo}
$ echo "$var"
foo
$ var=
$ var=${var-foo}
$ echo "$var"

$ unset var
$ echo "$var"

$ var=${var-foo}
$ echo "$var"
foo
1 Like