[gnu.bash.bug] stopping and backgrounding shell functions

andrewt@watnext.waterloo.edu (Andrew Thomas) (11/10/89)

I am using bash 1.04 on a uVaxII running Ultrix 2.0

If I attempt to stop a bash function using ^Z, the stop signal get sent to
the shell, causing it to stop if it is a non-login shell.  If the function
is executing an external command then that command is also stopped.

If I try to background a shell function using & on the command line, I get
an error listing like this:

local: can only be used in a function
local: can only be used in a function
describe_pid: No such pid (8064)!
local: can only be used in a function

because I used the local command in the shell function.

The shell function then runs, mails a message to maintainer, and core dumps.

The shell function in question is:

function distr ()
{
  local machines='watnext watsnew watsup watever watif watsleft'
  local current=`/bin/hostname`
  local curdir=$PWD
  if [ -z "$1" ] ; then
    echo Must provide at least one file name.
    return
  fi
  for file in $* ; do
    if [ ! -f "$file" ] ; then
      echo File: $file: not a plain file.
    else
      for i in $machines ; do
        if [ "$i" != "$current" ] ; then
          echo cp $file /nfs/${i}${curdir}/$file
          cp $file /nfs/${i}${curdir}/$file
        fi
      done
    fi
  done
}

Andrew Thomas
andrewt@watsnew.waterloo.edu	Systems Design Eng.	University of Waterloo
"If a million people do a stupid thing, it's still a stupid thing." - Opus