[comp.unix.shell] Sounds trivial, but it's not

sean@utoday.UUCP (Sean Fulton) (09/28/90)

We use a shell script and UUCP to do an automated ascii upload to a
publishing system that is pretty void of any knowledge of
communications with the outside world.

At any rate, we have a /bin/sh script that basically does:

	cu sysname <FILE

Where FILE is of the form:

~!/bin/slp10 	 			#wait 10 seconds
piles of data to be uploaded
~!/bin/slp10				#wait another 10 seconds
~.					#Hangup the telephone.

This has been somewhat reliable, but only allows for one file
per call. Given that there is a modem shortage on the remote end, this
is unacceptable.

So, does anyone have any ideas on how to do something like:

~!for a in `ls files`

... etc.

??
We're running on Xenix 2.3.3 if that makes a difference, using a TB+
over a 19200 serial line.

-- 
Sean Fulton					sean@utoday.com
UNIX Today!					(516) 562-5430
 /* The opinions expressed above are not those of my employer */

marekp@bkj386.uucp (Marek Pawlowski) (09/29/90)

On 27 Sep 90 21:04:58 GMT, Sean Fulton <sean@utoday.uucp> wrote:

> [..snipped..]
> This has been somewhat reliable, but only allows for one file
> per call. Given that there is a modem shortage on the remote end, this
> is unacceptable.
>
> So, does anyone have any ideas on how to do something like:
>
> ~!for a in `ls files`
> [..snipped..]

Simple, if I understood your question correctly.  Essentially, this relies on
doing the following:

cd /directory/containing/the/files/to/be/sent/out
for a in *
do
        foo
        [...]
        bar
done

Rather simple.
So, when do I get my free subscription to Unix Today?  :)

     Marek Pawlowski    || Intelligent Twist Software || You like bang-paths?
   marekp@contact.uucp  || 250 Harding Blvd.          ||
   root@aunix.uucp      || PO Box 32017               || uunet!contact!marekp
   marekp@generic.uucp  || Richmond Hill, Ontario     ||
   marekp@pnet91.uucp   || L4C 9M7        CANADA      ||    Don't we all?
   marekp@torag.uucp    ||____________________________||
   marekp@bkj386.uucp   ||                            ||

les@chinet.chi.il.us (Leslie Mikesell) (09/29/90)

In article <1815@utoday.UUCP> sean@utoday.UUCP (Sean Fulton) writes:

>We use a shell script and UUCP to do an automated ascii upload to a
>publishing system that is pretty void of any knowledge of
>communications with the outside world.

>At any rate, we have a /bin/sh script that basically does:
>	cu sysname <FILE
>Where FILE is of the form:
>
>~!/bin/slp10 	 			#wait 10 seconds
>piles of data to be uploaded
>~!/bin/slp10				#wait another 10 seconds
>~.					#Hangup the telephone.

>This has been somewhat reliable, but only allows for one file
>per call. Given that there is a modem shortage on the remote end, this
>is unacceptable.

>So, does anyone have any ideas on how to do something like:
>
>~!for a in `ls files`
>... etc.

Sure - you can just use
~$command
in your input to cu and "command" will be executed with its output directed
to the outbound line.  I'd suggest a script that simply cat's the files
from a directory one by one and then mv's them elsewhere.  That gives you
a chance to pick up where you left off if the connection is broken.

However... You can get a version of kermit for almost everything these
days although it is sometimes difficult to convince the administrator on
the other end that it is worth the trouble to locate and install it. Having
kermit at both ends makes this sort of thing trivial (as long as at least
one end handles scripts).

Les Mikesell
  les@chinet.chi.il.us

sean@utoday.UUCP (Sean Fulton) (09/30/90)

In article <1990Sep28.175140.17023@bkj386.uucp> marekp@bkj386.UUCP (Marek Pawlowski) writes:
>
>Simple, if I understood your question correctly.  Essentially, this relies on
>doing the following:
>
>cd /directory/containing/the/files/to/be/sent/out
>for a in *
>do
>        foo
>        [...]
>        bar
>done
>
>Rather simple.
>So, when do I get my free subscription to Unix Today?  :)

Consider your subscription done. But ... you didn't answer my
question. Assuming foo is cu [system]<$a, you've accomplished exactly
what I have. The hard part is being able to pipe all those files into
one cu. 

As an update, I tried

	cu [system] <sender

	where sender is:

	~$send.sh
	~.
	And send.sh is similar to what you described above (for a in
... cat $a). This seems to work, unless anyone has a better idea.


-- 
Sean Fulton					sean@utoday.com
UNIX Today!					(516) 562-5430
 /* The opinions expressed above are not those of my employer */

sean@utoday.UUCP (Sean Fulton) (10/01/90)

In article <1990Sep29.024105.29939@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes:
>
>However... You can get a version of kermit for almost everything these
>days although it is sometimes difficult to convince the administrator on
>the other end that it is worth the trouble to locate and install it. Having
>kermit at both ends makes this sort of thing trivial (as long as at least
>one end handles scripts).
>
Thanks for the suggestion. Unfortunately, the system on the other end
is Atex, a dying mainframe publishing system whose installers seem to
think it a priviledge for us to be able to dialup at all. The
~$command idea, however, works! Thanks again.
 

-- 
Sean Fulton					sean@utoday.com
UNIX Today!					(516) 562-5430
 /* The opinions expressed above are not those of my employer */

tif@doorstop.austin.ibm.com (Paul Chamberlain) (10/01/90)

On 27 Sep 90 21:04:58 GMT, Sean Fulton <sean@utoday.uucp> wrote:
> [..snipped..]
> This has been somewhat reliable, but only allows for one file
> per call. Given that there is a modem shortage on the remote end, this
> is unacceptable.
>
> So, does anyone have any ideas on how to do something like:
>
> ~!for a in `ls files`
> [..snipped..]

This may be functionally equivalent to an earlier response but it
was not clear from that response.

I didn't see the original posting but I will assume (since it's harder),
that you want to sleep between each file.  Hopefully, it's obvious what
to do if this isn't the case.

You could do one of the following:
	
	for a in `ls files`
	do
		echo sleep 10
		echo cat $a
		echo sleep 10
	done > /tmp/cu.cmd

	cu system <<\!
	~$sh /tmp/cu.cmd
	!

	rm /tmp/cu.cmd

or this might even work:

	for a in `ls files`
	do
		sleep 10
		cat $a
		sleep 10
	done | cu system

These weren't tested.  I think the '\!' is required to keep the $sh from
being expanded by the shell.  Extra credit for making the temp filename
a variable.

Paul Chamberlain | I do NOT represent IBM         tif@doorstop, sc30661@ausvm6
512/838-7008     | ...!cs.utexas.edu!ibmaus!auschs!doorstop.austin.ibm.com!tif