Re: [SLUG] mplayer and symbols in file name

From: Paul M Foster (paulf@quillandmouse.com)
Date: Tue May 11 2004 - 00:10:31 EDT


On Mon, May 10, 2004 at 08:56:24PM -0400, Chad Perrin wrote:

<snip>

> I take it, then, that anything inside quotes is typically interpreted by
> the shell, and the quotes only serve to group elements of a statement
> together.

In general, yes.

That's true for double-quotes, but not for single-quotes. That is:

something "$ANYTHING"

would fetch the value for the variable ANYTHING and insert that into the
quoted string. But

something '$ANYTHING'

would assume that $ANYTHING is a string literal. Backticks (`) behave
similarly to double-quotes, but execute what lies inside the
backtick-quoted string. This is usually used in assigning variables, as:

DATE=date
NOW=`$DATE +%Y-%m-%d`

would yield:

2004-05-11

An alternate way to execute something (besides backticks) is:

NOW=$($DATE +%Y-%m-%d)

And you can do integer math by using double parentheses:

$ SUM=$((3 + 2))
$ echo $SUM
$ 5

(More than you wanted to know, right?) ;-}

Paul
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:06:11 EDT