O'Reilly logo

Solaris™ Operating Environment Boot Camp by Dominic Butler, David Rhodes

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

Command Substitution

We have looked at the use of the single quote (') and the use of the double quote ("), but the back quote (`) is also a shell metacharacter and it is used to enable command substitution.

If the shell sees a pair of back quotes in a command line it will execute the entire command contained inside the back quotes first and then replace it with the output from that command. Then it will run the original command.

So if we wanted to edit a script called script1.sh that existed in a directory included in our path we could use the which command (we've already described this earlier) to locate the script and then type in the full path name:

 $ which script1.sh /usr/local/bin/script1.sh $ vi /usr/local/bin/script1.sh <output removed ...

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