O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Quoting

Quotes are used when assigning values containing whitespace or special characters, to delimit parameters and variables, and to assign command output.

There are three types of quotes: single quotes, double quotes, and back quotes. Single and double quotes are similar, except for the way they handle some special characters. Back quotes are used for command output assignment.

Look what happens when you try to perform a variable assignment using a value that contains whitespace without enclosing it in quotes:

					$ GREETING=Hello world
					/bin/ksh: world:  not found
					$ print $GREETING
					$
				

No assignment is made. To assign Hello world to GREETING, you would need to enclose the entire string in quotes, like this:

					$ GREETING='Hello world'
					$ print $GREETING ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required