Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

shell script store command output in variable

#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 by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #shell #script #store #command #output #variable
ADD COMMENT
Topic
Name
8+1 =