#!/bin/sh # copyright 2010 Mike Sliczniak # BSD style terms, no attribution needed, no claims/warantees expressed/implied # e.g. copy all non-hidden files and dirs from your home dir using protocol 2 # $ cd && stjput '-24 remuser@host' . * IFS=' ' case $# in [012]) echo 'Usage: stjput sshopts remdir file|dir [file|dir ...]' >&2 exit 2 ;; esac # some defaults, may not work with very old versions of ssh #sshopts='-24 -o PermitLocalCommand=no -qaxT '"$1"; shift sshopts='-qaxT '"$1"; shift remdir="$1"; shift # protect sh from stripping trailing whitespace, eg newline(s) case "$remdir" in '') # someone used '' instead of . for CWD! remdir=. ;; */) ;; *) # It does not matter to have the trailing / for a dir remdir="$remdir"/ ;; esac # need to prevent cd and mkdir thinking it is some option case "$remdir" in /* | .*) ;; *) remdir=./"$remdir" ;; esac foo() { n=$2 } # lots of testing shows that this works on many shells, # don't use $() or "``" and make sure that closing tick is all by itsewlf on the # last line n=`cksum <