How to store a command in a variable in a shell script?

前端 未结 8 1085
长情又很酷
长情又很酷 2020-11-22 07:35

I would like to store a command to use at a later period in a variable (not the output of the command, but the command itself)

I have a simple script as follows:

8条回答
  •  没有蜡笔的小新
    2020-11-22 08:22

    Its is not necessary to store commands in variables even as you need to use it later. just execute it as per normal. If you store in variable, you would need some kind of eval statement or invoke some unnecessary shell process to "execute your variable".

提交回复
热议问题