How to return a string value from a Bash function September 13, 2022 by Tarik There is no better way I know of. Bash knows only status codes (integers) and strings written to the stdout.