Store Result Of Command In Variable Bash

[Solved] Store Result Of Command In Variable Bash | Basic - Code Explorer | yomemimo.com
Question : store result of command in variable bash

Answered by : charred-dolphin

variable=$(command [option…] argument1 arguments2 …)

Source : https://linuxhint.com/bash_command_output_variable/ | Last Update : Fri, 20 Mar 20

Question : shell script store command output in variable

Answered by : armando-flores

#Just use following structure to store output of command into a variable:
var=$(command)
#For example:
var=$(echo 'hi')	#store hi into var
var=$(ls)	#store list of files into var

Source : | Last Update : Tue, 15 Dec 20

Answers related to store result of command in variable bash

Code Explorer Popular Question For Basic