Przeskocz do treści

Powershell quotes difference and subexpression

30 października 2013

If i learn some topic by myself i got some empty spaces in knowledge. In powershell (in other langs too)  i had always problem with remembering quotes diff and sub expression. Now i have got great book „Powershell in action” Bruce Payette (https://twitter.com/BrucePayette) and done some refresh and learning.

 

quotes – single and double

…In double-quoted strings, to embed the closing quote character you have to either quote it with the backtick character or double it up. In other words, two adjacent quotes become a single literal quote in the string.

…PowerShell supports variable substitutions. These variable substitutions or expansions are only done in double-quoted strings (which is why these are sometimes called expandable strings)…

…In single-quoted strings, doubling up the quote is the only way to embed a literal quote in the string. This is one area where an important difference exists between single- and double-quoted strings: in single-quoted strings, the backtick isn’t special. This means that it can’t be used for embedding special characters such as newlines or escaping quotes…

 

subexpression

…The expression in the $( … ) sequence in the string is replaced by the result of evaluating the expression…

 

http://www.amazon.com/Windows-PowerShell-Action-Second-Edition/dp/1935182137?tag=s601000020-20

Dodaj komentarz

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Wyloguj /  Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj /  Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj /  Zmień )

Połączenie z %s

%d blogerów lubi to: