Just appreciate solution using "" regex for string ending with slash: if[[ "some_string" != starting_string* ]]; then ...//some code