You need to add a space after the [
and before the ]
like so:
if [ "1" -eq "2" ]
However, that way is deprecated and the better method to use is:
#!/bin/bash
if ((1 == 2))
then
echo "True"
else
echo "False"
fi
More Related Contents:
- In the shell, what does ” 2>&1 ” mean?
- Difference between single and double quotes in Bash
- An efficient way to transpose a file in Bash
- Usage of :- (colon dash) in bash
- ssh breaks out of while-loop in bash [duplicate]
- What is the preferred Bash shebang?
- Return value in a Bash function
- I just assigned a variable, but echo $variable shows something else
- How to use aliases defined in .bashrc in other scripts?
- Bash script compare two date variables [duplicate]
- How to provide password to a command that prompts for one in bash?
- What is the difference between ${var}, “$var”, and “${var}” in the Bash shell?
- Custom Bash prompt is overwriting itself
- Deleting lines from one file which are in another file
- source command not found in sh shell
- How to check if a file contains a specific string using Bash
- How does this bash fork bomb work? [duplicate]
- How to enter ssh password using bash? [duplicate]
- How can I get a recursive full-path listing, one line per file?
- Command line to delete all ClearCase view-private files
- How to suppress variable substitution in bash heredocs
- What’s a concise way to check that environment variables are set in a Unix shell script?
- Using bash to sort data horizontally
- Best way to simulate “group by” from bash?
- How to split a file into equal parts, without breaking individual lines? [duplicate]
- Translating OS X Bash Script for Windows
- Assign a makefile variable value to a bash command result?
- Ignoring specific errors in a shell script
- Capture multiline output as array in bash [duplicate]
- How to change a command line argument in Bash?