🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Andrew Thomas Thu, 09 Nov 1989 22:08
stopping and backgrounding shell functions
#688
Author: Andrew Thomas
Date: Thu, 09 Nov 1989 22:08
46 lines
1828 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads