[lug] question about ftp script...
Stephen Coffin
scoffin at netcom.com
Tue Dec 14 16:20:08 MST 1999
>> Thanks, that did it, I assume that white space is all just white space
>> in shell, perl, and c. I guess I need to read up on the 'here'
>> documents. They didn't teach us this stuff in my Fine Arts degree...
yes :-)
>> One more problem... the positional parameters $1 through $4 seem to only
>> be local to the script, and not global. I can echo the values outside of
>> the function, but they echo as null from within the function. If I hard
The positional parameters are pushed onto a stack when the function starts,
since the function can use "set" internally to replace them, and you
don't want the function to over-write the original values in most
cases. This is why you can't see them inside the function.
>> code the file names, then the mput works, but using $1 - $4 no put
>> happens (well, actually I think it might put a null filename) How do I
>> pass the parameters into the function, or at least make
see a sample script below that does what you want. There are probably
several other ways to code this :-)
>> them global? Along the same line, does calling the function actually
>> start a child shell?
No, a function is executed directly by the current shell.
>> thanks,
like most UNIX things, experimentation and practice are very helpful :-)
=S.Coffin
GV Computing
scoffin at netcom.com
##########################################################
$ cat test_sh
#!/bin/sh
set ww ee rr tt
echo $1 $2 $4
X1=$1
X2=$2
X3=$3
X4=$4
function xxy () {
echo start
echo $X1 $X2 $X4
echo end
}
xxy
echo Done!
#########################################################
More information about the LUG
mailing list