shell_scripting_notes
compare strings
tags | string comparison, compare strings, if else condition
#! /usr/bin/env bash terminal_type=`uname -s | cut -f 1 -d '-'` if [ "$terminal_type" = "MINGW64_NT" ]; then echo "using git bash terminal" elif [ "$terminal_type" = "CYGWIN_NT" ]; then echo "using cygwin terminal" else echo "unknown terminal" fi # Ref: # * https://stackoverflow.com/questions/2237080/how-to-compare-strings-in-bash # * explains why the quotes (ex:- "$terminal_type") are important.
ref:-
- https://github.com/KamarajuKusumanchi/sampleusage/blob/master/bash/compare_strings.sh - latest version of the above script
shell_scripting_notes.txt · Last modified: 2021/08/11 22:05 by raju