neversaint
neversaint

Reputation: 63984

Addressing Ambiguous Redirect in Unix Pipe

I have a code that looks like this:

#!/usr/bin/bash
file1=foo.txt
file2=bar.txt
ouput=output.txt

join $file1 <(cut -f1 $file2 | sort -u) > $output

# We will further process $output

But it give me such error.

./mycode.sh: line 4: $output: ambiguous redirect

Is there a way to address it?

Upvotes: 1

Views: 928

Answers (1)

ajreal
ajreal

Reputation: 47311

cut -f1 $file2 | sort -u > sort.txt
join $file1 sort.txt > $output

just a bit curios, you don't get any other error message?

Upvotes: 1

Related Questions