Horje
save output of command to variable bash Code Example
save output of command to craible bash
password=$(openssl rand -base64 32)
echo $password
save output of command to variable bash
OUTPUT="$(ls -1)"
echo "${OUTPUT}"

MULTILINE=$(ls \
   -1)
echo "${MULTILINE}"
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




Shell

Related
device manager cmd command Code Example device manager cmd command Code Example
slow internet wifi speed on ubuntu 18.04 Code Example slow internet wifi speed on ubuntu 18.04 Code Example
makefile ifeq or Code Example makefile ifeq or Code Example
install tailwind Code Example install tailwind Code Example
ffmpeg mkv to mp4 Code Example ffmpeg mkv to mp4 Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11