I have a bash script that accepts a parameter "$input" and (among other things) directs it into a program and collects the output.
Currently my line is:
OUTPUT=`./main.exe < $input`
But I get the following error:
$input: ambiguous redirect
What is the correct way to do it?
$( ... )
should not have made a difference. The issue is the quoting of the variable. Using an unquoted variable in< $input
should still break horribly if the value in$input
contains spaces. – Kusalananda Feb 16 '19 at 17:31