Bhavya Arora Bhavya Arora - 1 year ago 92
Bash Question

Output of cut, value: command not found

I have a script

join -1 3 -2 3 $fileName1 $fileName2 > temp.txt
($(cut -d' ' -f1 temp.txt))

I expect the output to be


but I get

c: command not found

I am really new to bash scripting, any help would be appreciated :)

Answer Source

Just write:

cut -d' ' -f1 temp.text

When you put a command in $(), it substitutes the output back into the command line. And then, since this is at the beginning of the command line, it tries to execute the output as if it's another shell command.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download