How do you execute a command in a variable?

How do you execute a command in a variable?
Answer
Here, the first line of the script i.e. “#!/bin/bash” shows that this file is in fact a Bash file. Then we have created a variable named “test” and have assigned it the value “$(echo “Hi there!”)”. Whenever you want to store the command in a variable, you have to type that
command preceded by a “$” symbol.
 

Tìm kiếm

Back
Top