Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

store result of command in variable bash

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

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
Comment

PREVIOUS NEXT
Code Example
Shell :: …or push an existing repository from the command line 
Shell :: git reset head to previous commit 
Shell :: check file size linux 
Shell :: how to delete all branches in git local 
Shell :: big sur ERROR: Error installing ffi: ERROR: Failed to build gem native extension. 
Shell :: add more changes to same commit 
Shell :: docker up frce recreate 
Shell :: clock skew detected github 
Shell :: no wifi adapter found ubuntu 18.04 
Shell :: tr unix use 
Shell :: mac force quit 
Shell :: ubuntu port ping 
Shell :: refusing to exec crouton from noexec mount 
Shell :: amend specific commit 
Shell :: git amend commit message 
Shell :: linux install android sdk 
Shell :: grep in file content 
Shell :: unattended-upgr 
Shell :: linux command to clean up log files in /var/log 
Shell :: The platform "win32" is incompatible with this module. 
Shell :: td-agent restart 
Shell :: Bluetooth problem Linux 
Shell :: git reset to undo a merge 
Shell :: uninstall nvidia x server ubuntu 
Shell :: unknown error after kill: runc did not terminate sucessfully: container_linux.go:392: signaling init process caused "permission denied" 
Shell :: applescript run from cli 
Shell :: install netstat windows server 
Shell :: valgrind usage 
Shell :: Flatpak in linux 
Shell :: Method ReflectionParameter::getClass() is deprecated ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =