Home shell script to use cl1p.net online clipboard in linux - Error (23) Failed writing body
Reply: 1

shell script to use cl1p.net online clipboard in linux - Error (23) Failed writing body

Christoph Bimminger
1#
Christoph Bimminger Published in 2017-12-07 15:12:26Z

I am searching for a simple solution to send stdout (or a file content) from a linux host (raspi with bash) to my PC. The RaspberryPI has network/internet connection, but for security reasons it's not an option to set up SMB / FTP server on the raspi. It is anoying to send to an external FTP server all the time, using command line.

Please discuss general approaches (shell scripts for web form uploads, alternative options), and comment in particular on the scripting approach

I meanwhile tried to write a shell script...

#!/bin/bash
a='content='
b=`cat $2`
content=$a$b
curl -i -X POST https://cl1p.net/$1 -H "Content-Type: application/x-www-form-urlencoded" --data-binary "content=$content"

the script, as you see, should accept 2 command line args:

$1 ... clipboard "unique name"
$2 ... file to be sent to the clipboard)

When calling the script with the command line

$ ./sh ./bclip.sh 20171207testXX ./test.log

I expected to be able to download the content here: https://cl1p.net/20171207testXX

but when starting the script it says : not found.sh: 2: /boot/bclip.sh [... then the CURL upload output, and] (23) Failed writing body

What am I doing wrong?

Olli K
2#
Olli K Reply to 2017-12-07 17:18:58Z

Where'd you get the call to ./sh from? As the error says, there's no sh binary/script in your current location.You probably added that because you couldn't run your script directly?

Just remove the ./sh from the start and instead set the script as executable with chmod +x bclip.sh and call it with simply ./blicp.sh foo bar.log.

Copy the script to a location in you PATH env var (something like /usr/local/bin or ~/bin usually works) and you can call it without the path prefix ./

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.416692 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO