Parenthesis Check in Linux

In this blog, Sharing code to check whether Parenthesis or Brackets are correct in a string or not.Consider a String”[()]” should return “Parenthesis check Passed” while String “{()[(]))”should return “Parenthesis check Failed”. CODE EXPLANATION:1. Created two String OpenBracketStr and CloseBracketStr.2. Keep on Appending based on Character present in the String. If its a opening Bracket, it will be added to OpenBracketStr and as we have received Open Bracket type, I am adding a Expected Closed Bracket by myself in String called CloseBracketStr. In case I get 5 Opening bracket consecutively…

Remove all repeated Characters in a String

In this blog, sharing the code to remove consecutively repeated characters in a String. Consider a String “allabouttechnologies” . Here, l and t are repeated Characters. So, after applying logic, it will be like “alaboutechnologies“. str=”alllabouttechnologies” ##Sample Stringnewstr=” ##new Blank Stringn=${#str} ##length of a Sample StringPrevChar=${str:0:1} ##First Character of a Stringi=1while [[ $i -le $n ]] ##Looping Character by CharacterdoNextChar=${str:$i:1}if [[ $PrevChar == $NextChar ]] ##if two consecutive Character matches, it will remove or ignore the matched one and keep repeated Character oncethenecho “Ignore this Character: “$NextCharelsenewstr=${newstr}${PrevChar} ##merging only non-repeated…