#!/bin/bash

############################################################################
## Used to create virtual uart ports in /dev/pty and link them to two files
# silence this script using '-s' flag

USERPORT=$RVATOM/userport
SIMPORT=$RVATOM/simport

if [[ $1 != -s ]]
then
    printf "\033[0;36m$SIMPORT\033[0m <--\033[0;33m socat \033[0m--> \033[0;36m$USERPORT\033[0m\n"
fi

socat pty,link=$USERPORT,echo=0 pty,link=$SIMPORT,echo=0 &
echo "Socat PID: $!"