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