I have problem to hide error message from shell command as the following case.
firs_line=$(head -n 1 file) > /dev/null 2>&1
I expect that the error message will be hidden but actually it doesn't.
How to get output while head command is executed successfully but hide error message when it fails?
Thanks in advance.
$(). as is its trying to redirect the assignment, not the command outputfirs_linehaving an empty value when the call toheadfails.