bash-command-substitution

11y, 234d ago [edited]

Bash Command Substitution

There are two ways:

  • wrap the command in "`":
myvar=`cat /etc/motd`
  • wrap the command in "$()":
myvar=$(cat /etc/motd)

Choose either then then try this:

echo $myvar

Comments

hide preview ▲show preview ▼

What's next? verify your email address for reply notifications!

Leave first comment to start a conversation!