Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k
Source Link
nitishch
  • 461
  • 4
  • 10

Variable expansion in Bash

I tried the following commands

variable='one|name'
echo $variable

The output is

one|name

whereas echo one|name gives an error No command 'name' found. This is reasonable because bash treats | as a pipe and tries to execute command name with one as input.

But why does echo $variable print one|name? After Parameter and Variable expansion, shouldn't it be equivalent to echo one|name?

Version:

GNU bash, version 4.3.11(1)-release (i686-pc-linux-gnu)