shellgrepexporttee

Export all key value pairs from grep output without a loop


grep "=" someFile 

Above is returning few set of key value pairs like below.

foo=bar
id_num=6
some_val=best

Instead of using loop, is there a way to export all variable from the grep output.

Tried something like below, but is not resulting in desired behaviour

grep "=" someFile | tee export

Solution

  • What I would do, if you trust the input file (not generated dynamically by random users):

    source <(grep "=" someFile)