Assume that I have : .sh file having these commands :
#!/bin/bash
GIT_BRANCH="origin/release/2.4.0"
echo $GIT_BRANCH
then, I want to compute new varible from the GIT_BRANCH (operation of substring) : So,
RELEASE_VERSION=$( $GIT_BRANCH | cut -d "/" -f3)
echo $RELEASE_VERSION
But this does return message error : bad substitution
I tried many possibilities in the RELEASE_VERSION, but no result. like RELEASE_VERSION=$(echo $GIT_BRANCH | cut -d "/" -f3) RELEASE_VERSION=$("$GIT_BRANCH" | cut -d "/" -f3) and this return empty results