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

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -