source: trunk/essentials/app-shells/bash/examples/scripts.v2/frcp@ 3263

Last change on this file since 3263 was 3228, checked in by bird, 19 years ago

bash 3.1

File size: 7.1 KB
Line 
1#! /bin/bash
2#
3# original from:
4#
5# @(#) frcp.ksh 2.2 93/11/14
6# 92/06/29 john h. dubois iii ([email protected])
7# 92/10/14 Cleaned up, improved, added -d and -r options
8# 92/11/11 Made work with a dest of '.'
9# 93/07/09 Added -l and -n options, & login as anonymous if no .netrc entry
10# 93/11/14 Use either passwd or password in .netrc, since ftp does.
11#
12# conversion to bash v2 syntax by Chet Ramey
13#
14# frcp: ftp front end with rcp-like syntax.
15# Note: requires any machine names given to be listed with
16# user and password in .netrc. If not, anonymous FTP is
17# done.
18#
19# full path to ftp binary
20if [ -x /usr/bin/ftp ]; then
21 FTP=/usr/bin/ftp;
22elif [ -x /usr/ucb/ftp ]; then
23 FTP=/usr/ucb/ftp
24else
25 FTP=ftp
26fi
27
28istrue()
29{
30 test 0 -ne "$1"
31}
32isfalse()
33{
34 test 0 -eq "$1"
35}
36
37# For each filename given, put the filename in filename[n]
38# and the machine it is on in machine[n].
39function SplitNames {
40 typeset file
41 typeset -i i=1
42
43 unset filename[*] machine[*]
44 for file; do
45 case "$file" in
46 *:*) machine[i]=${file%%:*} ;;
47 *) machine[i]=$LocalMach ;;
48 esac
49 filename[i]=${file#*:}
50 let i+=1
51 done
52}
53