#!/bin/sh # uP2P.sh 0.0.1, 436 characters (excluding comments) [ $3 ]&&export W=$1 H="$2 $3" K=`mktemp`;Z=/dev/null;e(){ echo "$*";};n(){ nc $* 2>$Z;};x(){ nc -lp ${H#* } -e $1 &>$Z <$Z&};f(){ cat $K|while read h;do e $W $1 "$2"|n $h;done };case $# in 4)e $W s "$4"|n $H|while read h p f; do e $W g "$f"|n $h $p>"$f";done;;5)e $H>$K;e $W d $H|n $4 $5>>$K;x $0;;0)x $0 read w c r;[ $W = $w ]&&case $c in s)f l "$r";;g)cat "$r";;a)e $r>>$K;;d)cat $K f a "$r";;l)ls|grep "$r"|sed "s/^/$H /";;esac;;esac
Source: uP2P, mentioned here