I want to login to putty automatically via serial port through shell or bash script. This is the code:
#!/bin/bash
tty=/dev/$(dmesg | grep tty | tail -n 1 | sed -e 's/ /\n/g' -e 's/\t/\n/g' | grep tty)
tty=${tty%:}
sudo chown "$USER":"$USER" "$tty"
putty -serial "$tty" -sercfg 115200
But if I change the last line of code to:
putty -serial "$tty" -sercfg 115200 -l $username -pw $password
I get the following output:
PuTTY: the -pw option can only be used with the SSH protocol
Is there an alternative command, always via Putty, always via serial port?