How can I assign the output of a function to a variable using bash? December 16, 2022 by Tarik VAR=$(scan) Exactly the same way as for programs.