assign a variable with the value from a command + bash -
this question has answer here:
how assign variable value command?
this basic example of variable assignment:
$ line_count=2 $ echo $line_count 2
this command(the value 3) assign variable:
$ wc -l < file1.csv 3
but have tried not work:
$ line_count2=wc -l file1.csv -sh: -l: command not found
how can done?
one way is:
$ line_count2=$(wc -l < file1.csv) $ echo $line_count2
Comments
Post a Comment