I've tried to write the following code in bash but I am not able to get the output to be echoed.
part1="blkid | grep -P 'CENTOS 7' | cut -c1-9" echo "$part1"
Try this
part1=$(blkid | grep -P 'CENTOS 7' | cut -c1-9) echo "$part1"