#!/bin/bash
#s="32432423 jkhkjh [234] hkjh32 2342342"
s="[GLOBAL] and [MAIL_1]"
grep -o '\[[^][]*]' <<< "$s"