Linux awk string exec variable -


i have variable when echo looks this:

#echo $var awk '{print  $7 " " $6 " " $8 " "}' 

but if try like

#ls -lah | exec $var awk: '{print awk: ^ invalid char ''' in expression 

what doing wrong?

instead of exec need call eval:

ls -lah | eval $var 

however 2 cautions here:

  1. parsing ls output should avoided
  2. use of eval should minimised

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -