#!/usr/local/bin/bash -f # vimrcpfile # # Author : Dr. Charles E. Campbell, Jr. # Goddard Space Flight Center # Greenbelt Rd # Greenbelt, MD 20771 # # Purpose: ftp-s or rcp-s a specified file to # # Usage : vimrcpfile # (will prompt the user for what file to obtain) # # Modified by Louis Raphael for the bash shell. # give prompt and get response echo 'Enter machine:filename (rcp mode) -or-' echo 'Enter machine id password filename (ftp mode)' read -r response echo "response was <${response}>" # unset all current positional parameters # set response into positional parameters set -- ${response} # issue an rcp or ftp as appropriate if [ ${#} -eq 1 ]; then echo "attempting "'"'"rcp $1 tmp.vim"'"' rcp $1 tmp.vim elif [ ${#} -eq 4 ]; then if [ -r ~/.netrc ]; then echo "attempting ftp with .netrc pre-existing" mv ~/.netrc ~/.netrc.tmp echo "machine $1 login $2 password "'"'$3'"' > ~/.netrc chmod 600 ~/.netrc # get the file via ftp cat < ~/.netrc chmod 600 ~/.netrc # get the file via ftp cat <