How do I store a command in a variable and use it in a pipeline? [duplicate]
问题 This question already has answers here : Why does shell ignore quotes in arguments passed to it through variables? [duplicate] (3 answers) Closed 3 years ago . If i use this command in pipeline, it's working very well; pipeline ... | grep -P '^[^\s]*\s3\s' But if I want to set grep into variable like: var="grep -P '^[^\s]*\s3\s'" And if I put variable in pipeline; pipeline ... | $var nothing happens, like there isn't any matches. Any help what am I doing wrong? 回答1: The robust way to store a