December 1999
Beginner
528 pages
11h 10m
English
The back quote is the one to use when you want to assign output from system commands to variables. It tells the shell to take whatever is between the back quotes as a system command and execute its output. Using these methods you can then substitute the output into a variable. You can also combine quotes, as we shall see in a moment.
In the following example, the shell has tried to evaluate and substitute the word hello; because there is no command or script called hello, it responds with an error.
$ echo `hello`
sh: hello: command not found
Now let’s try again with the date command.
$ echo `date`
Sun May 16 16:40:19 GMT 1999
This time the command is valid, and the shell can evaluate it correctly.
Let’s now assign the output ...
Read now
Unlock full access