Can a variable name have a dash?

Can a variable name have a dash?

A ‘word’ consisting solely of letters, numbers, and underscores, and beginning with a letter or underscore. ‘Name’s are used as shell variable and function names. Also referred to as an ‘identifier’. So you can’t use a hyphen in a name.

What is hyphen in shell script?

A hyphen (used alone) generally signifies that input will be taken from stdin as opposed to a named file. ( it’s use, and any alternate use will be specified in the man page for each individual command)

Can Bash variables have dash?

# As of version 3 of Bash, periods are not allowed within variable names. Using a hyphen or other reserved characters in a variable name (or function name). Using the same name for a variable and a function. This can make a script difficult to understand.

Can environment variables have dots?

It is not possible to set environment variables with dots in their name. As workaround you have to set some environment variable that has no dots and then set the project property from that environment variable in your build script, but it would be better if the variable could be set.

Can Bash variables have periods?

_=25 echo $_ # $_ is a special variable set to last arg of last command. # As of version 3 of Bash, periods are not allowed within variable names. Using a hyphen or other reserved characters in a variable name (or function name).

What is dash in Bash?

More precisely, a double dash ( — ) is used in most Bash built-in commands and many other commands to signify the end of command options, after which only positional arguments are accepted. Most notably in the Bash set built-in, where it’s absolutely necessary.

Can bash variables have periods?

Is dash faster than bash?

If you need speed, go definitely with dash, it is much faster than any other shell and about 4x faster than bash.

How do I print an environment variable in Linux?

Linux List All Environment Variables Command

  1. printenv command – Print all or part of environment.
  2. env command – Display all exported environment or run a program in a modified environment.
  3. set command – List the name and value of each shell variable.

What is flag in bash?

flag is the iterator variable here. In bash the do followed by while statement specifies starting of block which contains satement to be executed by while . The ending of block is specified by done .