Using curl to insert an event into a calendar

Ups! Sorry, I completely forgot… :flushed:

Yes , I was able to solve the problem by using a HERE-document:

RNDUID=$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 22 | head -n 1)
CREATED=$(date -u "+%Y%m%dT%H%M%SZ")

$CURL -v  --user "$USER:$PASSW"  "$REMURL"  -T /dev/stdin <<-EOF
        BEGIN:VCALENDAR
        PRODID: //My script
        VERSION:2.0
        CALSCALE:GREGORIAN
        BEGIN:VEVENT
        CREATED:$CREATED
        UID:$RNDUID
        CLASS:PUBLIC
        CATEGORIES:Personal
        SUMMARY:$SUMMARY
        LOCATION:$LOCATION
        DTSTART:$DTSTART
        DTSTAMP:$DTSTART
        DTEND:$DTEND
        DESCRIPTION:$DESCRIPTION
        END:VEVENT
        END:VCALENDAR
EOF

Regard the “-” between “<<” and “EOF”: that dash is required, if you use tabs to format your script to increase readability. It removes any tabs from the data stream.

Somehow, this kind of upload behaves completely different than the option “-T” plus reading from standard input as described in the manual. If someone knows why a HERE document works but the option “-T” does not work, I’d be happy to learn! :slight_smile: