Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. variable definition - assign a value to a variable name
  2. variable reference - use the variable name to represent the value it holds

...

The shell will evaluate the varname $varname variable and substitute its value before writing output text.

...

Expand
titleHint...

Use env to see your built-in environment variables. You may want to pipe output to grep -i, or less -iI then search for "group" ignoring case (/group).


Expand
titleAnswer...


Code Block
languagebash
env | grep -i group  # is there an environment variable with "group" in its name?

Examining the env output we find that the variable MY_GROUP contains our Unix group.

Code Block
languagebash
echo The Unix group for $USER is $MY_GROUP


...