Artificial intelligent assistant

Strip newline from piped input I've been setting up a script to work with haste-server. This takes piped or file input (`tail /var/log/messages | haste` and `haste < /path/to/file.txt`) and submits it to the server which then outputs a in my terminal. See below: #!/bin/bash url=" key="$(curl --silent --data-binary @/dev/fd/0 $url/documents | cut -d "\"" -f 4)" echo "$url/$key" It works just fine, however it adds a trailing new line to the input. How can I read `@/dev/fd/0` to remove the `\n` new line? **Edit** : Here is my **completed script** for submitting a haste that trims the newline: #!/usr/bin/env bash url=" data=$(< /dev/fd/0) key="$(printf "%s" "$data" | curl -X POST -s --data-binary @- "$url/documents" | cut -d "\\"" -f 4)" echo "$url/$key"

### Avoiding newlines by 'echo' command

Instead of `echo`, use `echo -n`.

If that does not work (e.g. on OSX with `/bin/sh` as shell), or if you want make your script independent of which shell it runs under, use `/bin/echo -n `.

### Avoiding newlines from "payload" (here: '$key')

Change the output newlines with `tr`, e.g.


echo "$url/$key" | tr '\
' '|'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2448e2204bc4b003b3eab681b5deda25