SyntaxFix
Write A Post
Hire A Developer
Questions
🔍
[bash] How do I compare two string variables in an 'if' statement in Bash?
Home
Question
How do I compare two string variables in an 'if' statement in Bash?
You need spaces:
if [ "$s1" == "$s2" ]
Examples related to
bash
•
Comparing a variable with a string python not working when redirecting from bash script
•
Zipping a file in bash fails
•
How do I prevent Conda from activating the base environment by default?
•
Get first line of a shell command's output
•
Fixing a systemd service 203/EXEC failure (no such file or directory)
•
/bin/sh: apt-get: not found
•
VSCode Change Default Terminal
•
Run bash command on jenkins pipeline
•
How to check if the docker engine and a docker container are running?
•
How to switch Python versions in Terminal?
Examples related to
if-statement
•
How to use *ngIf else?
•
SQL Server IF EXISTS THEN 1 ELSE 2
•
What is a good practice to check if an environmental variable exists or not?
•
Using OR operator in a jquery if statement
•
R multiple conditions in if statement
•
Syntax for an If statement using a boolean
•
How to have multiple conditions for one if statement in python
•
Ifelse statement in R with multiple conditions
•
If strings starts with in PowerShell
•
Multiple conditions in an IF statement in Excel VBA
Examples related to
scripting
•
What does `set -x` do?
•
Creating an array from a text file in Bash
•
Windows batch - concatenate multiple text files into one
•
Raise error in a Bash script
•
How do I assign a null value to a variable in PowerShell?
•
Difference between ${} and $() in Bash
•
Using a batch to copy from network drive to C: or D: drive
•
Check if a string matches a regex in Bash script
•
How to run a script at a certain time on Linux?
•
How to make an "alias" for a long path?