Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash variables: case sensitive or not?

Is Bash shell scripting case sensitive?

Is variable date the same as DATE?

like image 768
Mario Avatar asked Mar 22 '13 13:03

Mario


People also ask

Should bash variables be capitalized?

By convention, environment variables ( PAGER , EDITOR , ...) and internal shell variables ( SHELL , BASH_VERSION , ...) are capitalized. All other variable names should be lower case. Remember that variable names are case-sensitive; this convention avoids accidentally overriding environmental and internal variables.

What does [- Z $1 mean in bash?

$1 means an input argument and -z means non-defined or empty. You're testing whether an input argument to the script was defined when running the script. Follow this answer to receive notifications.

Are Linux env variables case-sensitive?

3. (macOS/Linux) Environment Variables. Environment variables in macOS/Unixes are case-sensitive. Global environment variables (available to ALL processes) are named in uppercase, with words joined with underscore ( _ ), e.g., JAVA_HOME .

Are variables case-sensitive?

Variable names are not case sensitive. That is, you can use a name as uppercase on one line and lowercase on the next; both refer to the same variable. Production Reporting initializes variables to null (text and date) or zero (numeric).


1 Answers

Yes, it is case sensitive, just like the rest of UNIX. $date and $DATE are two different variables. makefile and Makefile are two different files. -h and -H are two distinct flags (usually).

like image 78
John Kugelman Avatar answered Oct 10 '22 02:10

John Kugelman