Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 1996 11:16:50 -0400
From:      Chet Ramey <chet@odin.INS.CWRU.Edu>
To:        koshy@india.hp.com
Cc:        hackers@freebsd.org
Subject:   Re: SH bugs?
Message-ID:  <9607091516.AA04351.SM@odin.INS.CWRU.Edu>
In-Reply-To: Message from koshy@india.hp.com of Tue, 09 Jul 1996 09:11:55 %2B0530 (id <199607090341.AA093623716@fakir.india.hp.com>)

next in thread | previous in thread | raw e-mail | index | archive | help
> Bug 1:
> ~~~~~
> 
> SH does not expand wildcarded terms properly
> 
> 	$ cd /tmp
> 	$ touch bletch
> 	$ ls bletch
> 	bletch
> 	$ cat < /tmp/bl*
> 	cannot open /tmp/bl*: no such file

POSIX.2 says an interactive shell is permitted to not do pathname
expansion on the filename in a redirection specification. 
Non-interactive shells may not do it at all; interactive shells may do
it only if the expansion results in a single word. 

The FreeBSD sh conforms to POSIX in this respect.

> Bug 2:
> ~~~~~~
> 
> CTRL-Z when executing a `for' loop works wierdly
> 
> 	$ cd /tmp/
> 	$ for i in /usr/share/doc/handbook/*.html; do
> 	  echo $i
> 	  ln -s $i .
> 	  done
> 	<hit ctrl-Z a few times>
> 	$ jobs -l
> 	[1] 1023 Stopped              ln -s ${i} .
> 	[2] 1077 Stopped              ln -s ${i} .
> 	[3] 1115 Stopped              ln -s ${i} .
> 	[4] 1128 Stopped              ln -s ${i} .
> 	[5] 1139 Stopped              ln -s ${i} .
> 
> These `jobs' need to be restarted explicitly : $ kill -CONT 1023 1077 ....
> or $ fg %1 ...

It's not all that weird.  Job control works only on processes started
as children of the shell.  It cannot be used to suspend an entire for
loop.  If you want to suspend the loop as a whole, put the command in
parentheses to force it into a subshell. 

> Bug 3:
> ~~~~~~
> 
> `kill' doesn't accept the %<job-number> syntax
> 
> 	$ kill %1
> 	kill: illegal process id: %1

I don't think `kill' is a shell builtin on FreeBSD.  Since it's an
external command, it cannot know about job control identifiers.  It
should be possible to write a shell function to add the desired
behavior to kill using the `jobid' builtin; I believe a sample is
distributed with the FreeBSD sh source. 

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9607091516.AA04351.SM>