I am trying to get the output of a command set to a variable but when I run it with the Command substitution, the command returns a blank line
[user@host bin]$ ./MyAppRead 4
Segmentation fault (core dumped)
[user@host bin]$ BALLS=$(./MyAppRead 4)
[user@host bin]$ echo $BALLS
[user@host bin]$
I am expecting BALLS to be set to "Segmentation fault (core dumped)" but it is blank?
-EDIT-
Changed to reflect the advice below. But still coming back blank
[user@host bin]$ ./MyAppRead 4
Segmentation fault (core dumped)
[user@host bin]$ BALLS=$(./MyAppRead 4 2>&1)
[user@host bin]$ echo $BALLS
[user@host bin]$