1

Difference between environment variable and shell variable

view story
linux-howto

http://unix.stackexchange.com – It is said that environment variables are inherited in child processes but shell variables are not. However the following test shows shell variables are seen in child process just as environment variables. What is the difference? > bash --version GNU bash, version 3.2.39(1)-release (x86_64-suse-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc. > export TEST="ENV_TEST" #env var > sh -c "echo \$TEST" ENV_TEST > TEST="SHELL_TEST" #shell var > sh -c "echo \$TEST" #shell var is seen in child process SHELL_TEST (HowTos)