Using the Backtick to Replace a String with Output

You can use the backtick (*) character to signal the shell to replace a string with its output when executed. This special character can be used in shell programs when you want the result of the execution of a command to be stored in a variable. For example, if you want to count the number of lines in a file called test.txt in the current directory and store the result in a variable called var, you can use the following command:

Command Environment var=*wc -l pdksh and bash test.txt*

Was this article helpful?

0 0

Post a comment