PROGRAM delim
    IMPLICIT NONE
    INTEGER :: err
    CHARACTER(LEN=20) :: data

    OPEN (42, FILE="/dev/tty", ACTION='write', IOSTAT=err)
    IF (err /= 0) THEN
        PRINT *, "Unable to open /dev/tty"
        STOP 1
    END IF

    READ (*, *) data
! Either of these two methods works, plus others.
    WRITE (42, *) '"', TRIM(data), '"'
    WRITE (42, *) '"' // TRIM(data) // '"'

    IF (err /= 0) THEN
        PRINT *, "Unable to write to /dev/tty"
        STOP 1
    END IF
    CLOSE (42, IOSTAT=err)
    IF (err /= 0) THEN
        PRINT *, "Unable to close /dev/tty"
        STOP 1
    END IF
END PROGRAM delim
