Bhavya Arora Bhavya Arora - 1 year ago 46
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 :)


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.