I saw similar questions about storing output into variable but it did not solve my issue.
So, I have been trying to store the output message from Github CLI to a variable in bash. So when I execute this command
gh pr list --search "123abc4"
It will print "no pull requests match your search in Repo" since no PR introduced to the given commit SHA(123abc4).
My issue is I want to store that output message "no pull requests match your search in Repo" into a variable. As usual, I am using this bash code
commitCheck=$(gh pr list --search "123abc4")
But it does not work. I used with echo and no luck as well. I am assuming it happens because the command is from Github Cli API.
I was wondering if anyone has used that before and how did you store the output message into a variable?
Thanks so much.