Syntax

Bash Use a Variable Syntax

In Bash, use a variable: expands a variable's value — echo "Hi $name"

Quick Answer

Syntax
echo "Hi $name"
BashSyntax

Use a Variable

Code example
echo "Hi $name"

Expands a variable's value.

Learn More

How to use a variable in Bash

  1. Open your Bash file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Bash Use a Variable Syntax

Use echo "Hi $name".

Related Syntax References

Frequently asked questions

What is the Bash syntax for use a variable?

Use this pattern: echo "Hi $name"

Can I copy this Bash code example?

Yes. Use Copy code and adapt the example to your program.

Is this Bash syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify