scripts

shell scripts
git clone git://git.bitsmanent.org/scripts
Log | Files | Refs | README

commit fba1fb15c5d2636b6a771143909768c3e90b763f
parent 2684b17a391f0111c4995fae6ca2c438c22c7fba
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Thu, 28 Jun 2018 23:16:46 +0200

[txthole] Allow to set public hostname

Diffstat:
MREADME.md | 21++++++++++++++-------
Msrc/txthole | 6+++++-
2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -27,18 +27,25 @@ txthole ------- Store and retrieve text stream. Given the script is up and running, here's a sample usage: -``` -$ echo Hello |nc your.host 2023 -echo GmKwL |nc your.host 2023 -$ echo GmKwL |nc your.host 2023 -Hello -$ -``` + $ echo Hello |nc your.host 2023 + echo GmKwL |nc your.host 2023 + $ echo GmKwL |nc your.host 2023 + Hello Of course you can also paste files: $ cat /tmp/t |nc your.host 2023 +You can set hostname when starting txthole, like this: + + $ TXTHOLE_PUBHOST=my.public.host txthole & + +If it's unset then txthole will only output the code instead of the whole command: + + $ txthole & + $ echo Hello |nc your.host 2023 + A1Syh + This should be enough for most use cases. iwpick diff --git a/src/txthole b/src/txthole @@ -19,7 +19,11 @@ run() { if [ -f "$p" ]; then cat "$p" else - echo "echo $label |nc your.host $port" + if [ -n "$TXTHOLE_PUBHOST" ]; then + echo "echo $label | nc $TXTHOLE_PUBHOST $port" + else + echo "$label" + fi fi }