CodeWithPride
CodeWithPride

Reputation: 123

Bash syntax variable value assignment

I am new to bash scripting. I came across the following piece of code and I am not able to figure it out. Please help me understand.

var1=$var1 some_function_call $var2

var2 is argument to "some_function_call" function.

I am not able to figure out exactly what is going on here. Thanks in advance.

Also any pointer to good bash scripting tutorials would be nice.

Thanks.

Upvotes: 1

Views: 48

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799410

The environment of the new some_function_call process has "var1" set to the value of $var1; the environment variable does not change in the main interpreter. The value in $var2 is passed as an argument to some_function_call.

Upvotes: 4

Related Questions