#!/bin/bash
s="32432423 jkhkjh [234] hkjh32 2342342"
grep -oP '\[\K[^][]*(?=])' <<< "$s"