The back quotes in Unix

I was trying out this great script to make backups: thanks to Julius’ blog

I realised that there was a line:

date_daily=`date +"%d-%m-%Y"`

with the back quote `

Ok. I thought it could have been a problem of cut&paste because I have not come across this quote in other programming languages I use (ruby, javascript, php). But after a quick search I learnt that it is used to execute commands.

I learnt it here:


2 thoughts on “The back quotes in Unix

  1. I’ve never heard of the term “back quote”, always “backtick”.

    Anyway, although backtick is more portable, I prefer using Bash’s `$()`. They are called Command Substitution.

    You can also use `printf -v date_daily ‘$(%d-%m-%Y)T’ -1`, more efficient since it doesn’t need to run external command, that’s `date`.

    Read bash(1), there is always something to learn in Bash’s manpage.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s