Skip to main content

Output of a command in a shell script

When you want to assign output of a shell command to a variable in your shell script, you have to write shell command between special quotation marks ` <command here> `

example: This command shows oldest two backups.
old_backups=`ls -td backup* | awk 'NR>2'`
echo $old_backups


Popular posts from this blog