Bash - how can i pass variable to command and read its output

Posted by Skuja on Server Fault See other posts from Server Fault or by Skuja
Published on 2010-04-19T18:12:48Z Indexed on 2010/04/19 18:13 UTC
Read the original article Hit count: 479

Filed under:

In my bash script i want to execute command that will find lines in a file that starts with a keyword which is stored in a variable like this:

keyword="key" 
result=(`cat path/to/my/file | grep '^$keyword'`)

© Server Fault or respective owner

Related posts about bash