phpMySQL use backticks ` to surround column names, and I've just see people use backticks in shell scripts.
Is that the same if they use ' ?
phpMySQL use backticks ` to surround column names, and I've just see people use backticks in shell scripts.
Is that the same if they use ' ?
In MySQL
, backticks could be used to enclose table and column names which are reserved words, like this:
SELECT *
FROM `table`
Single quotes just denote a string constant:
SELECT *
FROM `table`
WHERE `name` = 'test'
In shells, backticks let you use the output of one command as an argument to another command:
echo `date`
will execute date
and use its output as an argument to echo
.
Single quotes let you use whitespaces, dollar signs and backslashes inside the arguments:
echo '$HOSTNAME'
will output the string $HOSTNAME
as it is,
echo $HOSTNAME
echo "$HOSTNAME"
both will output the value of the environment variable HOSTNAME
.
In shell, a pair of backticks will be replaced by the (stdout) output of the command they enclose.
X=`expr 3 \* 2 + 4` # expr evaluate arithmatic expressions. man expr for details.
echo “$X”