Syntax

Bash Set a Variable Syntax

In Bash, set a variable: assigns a value (no spaces around =) — name="Ada"

Quick Answer

Syntax
name="Ada"
BashSyntax

Set a Variable

Code example
name="Ada"

Assigns a value (no spaces around =).

Tip: No spaces around the = sign.

Learn More

How to set 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.

Tip: No spaces around the = sign.

Bash Set a Variable Syntax

Use name="Ada".

Related Syntax References

Frequently asked questions

What is the Bash syntax for set a variable?

Use this pattern: name="Ada"

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