I am learning the bash environment and cannot understand what I get when running this command:
wc filename.txt &
It returns an array with a 1-digital integer and another integer, neither of them matches any other result I can get from wc commands (-l, -m, -w, -c). Besides the second integer is much bigger than for example the bytes counts. So I terribly wonder. I browsed forums and found some explanations on the multiple uses of the ampersand in a Unix/Linux environment, but there was nothing that I could relate. I don't need it, but I won't flush this mystery away, I wish to understand! Thanks
I imagine the integers you see are similar to this:
[1] 1830
&
launches a command in the background, and the shell prints its job number (1
) and process id (1830
). On a longer-running job, you can use those two numbers to control its execution. See the JOB CONTROL
section of the bash man page for more details.