[comp.bugs.sys5] Wierd shell bug could be useful

gwyn@smoke.brl.mil (Doug Gwyn) (01/31/91)

In article <618@tndsyd.oz> root@tndsyd.oz (the main man) writes:
>Try this out:
>	$ echo > foo '
>	> garbage
>	> '
>A user friendly bug !!!

What do you mean, bug?  The Bourne shell has always been advertised
as accepting I/O redirections anywhere among the arguments.

Harald.Eikrem@elab-runit.sintef.no (01/31/91)

said root@tndsyd.oz    [which is no valid internet mail address --H.E]:

> Try this out:
> 	$ echo > foo '
> 	> garbage
> 	> ...
> 	> ...
> 	> ...
> 	> ...
> 	> '
> 	$
> 
> Then cat foo. This is a wierd bug but could be used instead of:
> 	cat << ! > foo
> 	garbage
> 	...
> 	...
> 	...
> 	...
> 	!
> 
> A user friendly bug !!!

What do you mean is a bug here?  This behaves perfecly normal to me, and of
course the two methods produce different results.

$ echo > foo '
> bar
> and
> grill
> '
$ cat foo    

bar
and
grill

$ cat << ! > foo
> bar
> and
> grill
> !
$ cat foo
bar
and
grill
$ 


--Harald E

sef@kithrup.COM (Sean Eric Fagan) (01/31/91)

In article <618@tndsyd.oz> root@tndsyd.oz (the main man) writes:
>Try this out:
>	$ echo > foo '
>	> garbage
>	> '

Uhm, why do you consider this a bug?  That's doing exactly what I would
expect it to.

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef@kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.

root@tndsyd.oz (the main man) (01/31/91)

Try this out:
	$ echo > foo '
	> garbage
	> ...
	> ...
	> ...
	> ...
	> '
	$

Then cat foo. This is a wierd bug but could be used instead of:
	cat << ! > foo
	garbage
	...
	...
	...
	...
	!

A user friendly bug !!!

jeff@onion.rain.com (Jeff Beadles) (02/02/91)

In article <618@tndsyd.oz> root@tndsyd.oz (the main man) writes:
>Try this out:
>	$ echo > foo '
>	> garbage
>	> '
>	$

This is not a bug!  I often write scripts with something like this:

$ < file program > file2

The shell will allow redirection operators ('<' and '>') most anywhere.

It's not a bug, it's a FEATURE! :-)


	-Jeff
-- 
Jeff Beadles		jeff@onion.rain.com