Tuesday, May 2, 2017

Three types of quotes in the world..

If you’ve dealt with the Linux shell it’s very likely you would have come across different types of quotes. They mean different things to the shell and as such they are handled by it in different ways. Here’s a quick review.


#!/bin/bash
VAR="print me!"
#double quotes resolve variables.
echo "value is $VAR"
#single quotes process the content literally.
echo 'value is $VAR'
#backquotes execute commands in a new shell, stdout of execution is handed back to the caller.
echo "cmd `date`"
view raw quotes.sh hosted with ❤ by GitHub

No comments:

Post a Comment

What's in my Bag? EDC of a Tester