====== Simple Improvements for Simple Scripts ======
Did you ever suddenly notice that something simple you've been doing for years could be vastly improved with just a little bit of tweaking? I did yesterday concerning the transfer of files with netcat (e.g. when nobody got sendfile installed and standard paranoia forbids simply using scp instead) and figured I should share my sudden "enlightenment" ;-)
#!/bin/sh
host=$1
shift
tar cv "$@" | pv -brt | nc -q0 $host 23000
#!/bin/sh
netcat -l -p 23000 | pv -brt | tar xv
Note: piping to ''[[http://www.ivarch.com/programs/pv.shtml|pv]]'' is optional \\
**Edit**: fixed a word splitting bug and specified a default port
{{tag>sh quick_and_dirty tools}}
~~DISCUSSION~~