How to assign the cat output of a bash script to a variable in another script

轉載自https://unix.stackexchange.com/questions/181423/how-to-assign-the-cat-output-of-a-bash-script-to-a-variable-in-another-script

var=$( cat foo.txt )

would store the output of the cat in variable var.

var=$( ./myscript )

would store the output of myscript in the same variable.

猜你喜欢

转载自blog.csdn.net/u011028408/article/details/81774110