bash-command-substitution

12y, 105d 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

We'll email a 6-digit code to verify your comment and notify you of replies.

hide preview ▲show preview ▼
Leave first comment to start a conversation!