I need to do about a 500k translation of objectids obtained through SNMP of a new switch in a project. this quantity of work can be done only through a script, so I wrote this short bash script to do the job but I'm getting an error "command substitution: line 33: syntax error near unexpected token '&' This is the bash script:
    #! /bin/bash
    #...some code to check arguments here
    input=$1
    shift
    output=$1
    #open the connection
    `stty -F /dev/ttyACM0 115200 raw`
    `exec 3</dev/ttyACM0>$output` # trying to redirect serial port output to file
    `cat <&3 >> &output`  # trying to append output of serial, ERROR HERE
    while read line;
    do
    echo "getMib $line">/dev/ttyACM0
    done<$input
    echo done with file $input
 
    