HDTenEightyP/NetNews huggingface dataset:
From: shujaat@ferrari.raleigh.ibm.com ()
Subject: Problem with background kill.
Originator: shujaat@ferrari.raleigh.ibm.com
Date: Tue, 06 Oct 1992 22:24:30 GMT
Distribution: usa
Organization: IBM, Research Triangle Park, NC 27709

Hi there,
	I am experiencing a strange problem after executing my script
, the problem is that once the shell gets executed the window in which
the shell was executed does not display the commands on the command line
but executes them.  On pressing return on the prompt the prompt shows back
on the same line, rather than a new line.  Each time after executing the
script I have to get a new window, inorder to test the script.  Another
problem that I wanted to ask you guys was, how can I suppress the output
after the kill commands output.      


catchandkill() {
	sleep 10
	username=`who am i | cut -d' ' -f1`
	processdetail=`ps -u$username | grep dosdir | cut -d' ' -f3`
	if [ -n "$processdetail" ]; then
		echo 'This is not a dos formatted disk.'
		kill -9 $processdetail 
	fi
}
				
catchandkill &
dosdir -l > /dev/null 2>&1

			
			Thanks,		Shujaat.

internet: shujaat@vnet.ibm.com
Newsgroups: comp.unix.shell
From: sasmob@chewy.unx.sas.com (Mark Burhans)
Subject: Re: question
Originator: sasmob@chewy.unx.sas.com
Date: Fri, 2 Oct 1992 15:06:24 GMT
Organization: SAS Institute Inc.


In article <1992Oct1.142007.4778@dekalb.dc.peachnet.edu>, eric@dekalb.dc.peachnet.edu (Eric Weylin Scoggins) writes:
|> I have a program that runs in the background. When I log off, because of the
|> way the program is set up, it keeps running. My question is this, how can I 
|> set up a script that will restart it from time to time, even when I am not
|> logged on. This program uses memory at an increasing rate over time, so it
|> becomes necessary to restart it.

Heheheh!  I don't EVEN want to know what this program is!  Scares me!
:-)

Anyway, the 'crontab' command might be of benefit... if you are allowed to
use cron.  Fastest way to find out if you are authorized to use cron is
to try to use crontab.  Don't think I'm trying to confuse you, I am
using two different program names for the same program because one is
the "parent" (cron) that is loaded at boot time and the other (crontab)
is what a user uses to add to cron jobs.  (Blab blab blab)

Create a file, say, named ".crontab" with this format:

Minute(0-59) Hour(0-23) DayOfMonth(1-31) Month(1-12) DayOfWeek(0-6) Command

For example:

# run 'myprogram' at 4am every day of every month.
0 4 * * * myprogram

# run 'myprogram' at 3:23pm on March 12.
23 15 12 3 * myprogram

# run 'myprogram' at 7pm on every Monday
0 19 * * 1 myprogram


So, you create the file ".crontab" with this stuff in it, then you type:
  crontab .crontab

If you are allowed to use cron, you will see something like:
  WARNING:  commands will be executed using /bin/sh

Do a 'man crontab' to find out other features of 'crontab'
-- 
---Mark C. Burhans---sasmob@chewy.unx.sas.com---919/677-8001 ext 7324
SAS Institute, Inc., USA, SAS Campus Drive, Cary, NC 27513.
--Ever wonder what noises the phone would make had it been invented by
Mr. Bowels? --
 
Newsgroups: comp.unix.shell
From: holger@is.morgan.com (Holger Veith)
Subject: force alias ?
Organization: Morgan Stanley - IS
Date: Tue, 29 Sep 1992 21:48:40 GMT

IF ... from a previous message ...

---------------------------------------------------------------------------

Preceding a command name with "\" will prevent alias substitution, so type
"\rm -f file".

---------------------------------------------------------------------------

then on the oher hand, how can I force an alias lookup?  I run an emulator
and alias x3270=x3270 -a -g.  When I run x3270 from my root menu
(coded in .mwmrc) it does not pick up the alias, so I have to put the same
-a -g options into my .mwmrc file.

How can I force an alias look-up?

Holger.
Newsgroups: comp.unix.shell
From: eggert@twinsun.com (Paul Eggert)
Subject: Re: sccs2rcs problem
Organization: Twin Sun, Inc
Date: Tue, 29 Sep 1992 21:41:46 GMT

RCS imposes three constraints on dates:

	1.  Dates must be consistent with version numbers, e.g. revision 1.2's
	date can't precede revision 1.1's date.

	2.  RCS inherits the constraints of the underlying Unix/Posix time
	routines.  A typical case is an origin-1970 32-bit 2's complement
	time_t, representing times from 1901/12/13 20:45:52 UTC through
	2038/01/19 03:14:07 UTC, except that 1969/12/31 23:59:59 UTC (which
	corresponds to (time_t)-1) is reserved as an error value.

	3.  A date's year must fall in the range 0..9999999999999999.  This
	constraint is typically superseded by (2).

In Strockbine's example, it looks like (1) is the problem, and I
suspect it's a bug in sccs2rcs.  That is, my guess is that `sccs prs
-r9.0 cinter.sa' doesn't output a date line.  This causes the line

	set date = `sccs prs -r$rev $file | grep "^D " | awk '{printf("19%s %s", $3, $4); exit}'`

in sccs2rcs to set `date' to the empty string.  So sccs2rcs invokes `ci
-r9.0 -d"" ...', which sets revision 9.0's RCS date to be today's date;
then when sccs2rcs tries to check in revision 10.1, dated 1990, `ci'
properly complains that the dates are out of order.

(I'm posting this response to Usenet, since the original article's
Reply-To: address `gstrock@dpc.com' doesn't work on the Internet.)
Newsgroups: comp.unix.shell,comp.unix.questions
From: dattier@ddsw1.mcs.com (DWT)
Subject: Re: Shell question
Date: Fri, 2 Oct 1992 18:00:20 GMT
Organization: Contributor Account at ddsw1, Chicago, Illinois  60657
Keywords: ksh, csh et all.
Followup-To: comp.unix.shell

[Follow-ups to comp.unix.shell, please.]

wayne@jahangir.UUCP (wayne) wrote in <776@jahangir.UUCP>:

|      Is there a way to test a shell variable to tell if it's
| an integer or a string?

All shell variables are strings.  What we can test is whether the string
qualifies as an integer or not.

In csh, don't ask me.

In sh and ksh and presumably in bash,

case $variable in
[!0-9+-]*|?*[!0-9]*) echo not an integer ;;
 # If the first character is neither a sign nor a digit, or if
 # any character after the first isn't a digit, it is not an integer.
"") echo null string ;;
*) echo integer ;;
esac

in ksh,

typeset -i holder
if (holder=$variable)
 # The parentheses to make a subshell might be unnecessary in your ksh version.
then echo integer
else echo not an integer
fi

also in all but the oldest ksh versions,

case $variable in
?([-+])+([0-9])) echo integer ;; # perhaps a sign, then one or more digits
*) echo not an integer ;;
esac

There should also be ways to do it with ksh's $(( )) syntax, bash's $[ ]
counterpart, or ksh's let command.

David W. Tamkin   Box 59297   Northtown Station, Illinois  60659-0297
dattier@ddsw1.mcs.com    CompuServe: 73720,1570    MCI Mail: 426-1818
From: denis@smoky.ikf.physik.uni-frankfurt.de (Denis Endisch)
Newsgroups: comp.unix.shell
Subject: Re: #!/bin/sh | #!/bin/ksh ...
Date: 1 Oct 92 11:20:11 GMT
Organization: Institut fuer Kernphysik, Frankfurt/Main

dinguyen@wam.umd.edu (Dzi Nguyen) writes:
>I encountered which really bother, 'cause I couldn't find any documentation
>about it that is most shell script at the top of the files they always have
>this line:
>#!/bin/sh 
>or
>#!/bin/ksh
>or
>#!/bin/csh

This at the very first line of a shell script decides which shell should
be used to execute it.
Sine a script for the sh is not compatible with a csh script, it is necessary
to be sure that the correct shell is used. By default, shell scripts are
executed by the shell you are currently using.
E.g if you use the csh and write a shell script which works fine for you, it
can not be used by someone who uses the sh.

Denis
--
Denis Endisch, Institut fuer Kernphysik
August-Euler-Str. 6, 6000 Frankfurt 90, Germany
EMAIL: denis@smoky.ikf.physik.uni-frankfurt.de
From: dataprod@nic.cerf.net (Allen Russ)
Newsgroups: comp.unix.shell
Subject: sccs2rcs problem
Date: 26 Sep 92 23:56:04 GMT
Reply-To: gstrock@dpc.com
Organization: CERFnet

I'm trying to convert our SCCS files to RCS using the sccs2rcs 
script that comes with the GNU rcs distribution.  Most of our SCCS
files go back to 1989.  The sccs2rcs script always barfs on these
files giving the output below.  Is there some age limit here?
	greg strockbine, dataproducts, woodland hills, ca.
=========
Log file:
COMMENTS:
100
RCS/sysini.sa,v  <--  sysini.sa
new revision: 8.2; previous revision: 8.1
done
9.0
new delta 9.0.1.1
1834 lines
RCS file: RCS/sysini.sa,v
8.2 locked
done
0
?
ci warning: missing author for -w option
RCS/sysini.sa,v  <--  sysini.sa
new revision: 9.0; previous revision: 8.2
done
10.1
new delta 10.1.1.1
1834 lines
RCS file: RCS/sysini.sa,v
9.0 locked
done
153
COMMENTS:
63
RCS/sysini.sa,v  <--  sysini.sa
ci error: Date 1990/10/03 11:07:01 precedes 1992/09/26 22:38:40 in existing revision 9.0.

=========
Output to terminal:
==> file sysini.sa, rev=7.2, date=1990/08/01 08:05:29, author=gregs
checked out of SCCS
performed keyword substitutions
got lock
checked into RCS

==> file sysini.sa, rev=8.1, date=1990/08/02 19:37:03, author=lzr1550
checked out of SCCS
performed keyword substitutions
got lock
checked into RCS

==> file sysini.sa, rev=8.2, date=1990/08/08 16:55:56, author=peters
checked out of SCCS
performed keyword substitutions
got lock
checked into RCS
ERROR: invalid sid (co8)
ERROR: invalid sid (co8)

==> file sysini.sa, rev=9.0, date=, author=
checked out of SCCS
performed keyword substitutions
got lock
ERROR: invalid sid (co8)
checked into RCS

==> file sysini.sa, rev=10.1, date=1990/10/03 11:07:01, author=lzr1550
checked out of SCCS
performed keyword substitutions
got lock
17.9
2423 lines


Danger! Danger!
Some command exited with a non-zero exit status.

Xref: sparky comp.unix.shell:4135 comp.unix.admin:5237 comp.unix.wizards:4083
From: haley@husc10.harvard.edu (Elizabeth Haley)
Newsgroups: comp.unix.shell,comp.unix.admin,comp.unix.wizards
Subject: Re: Locking out users
Date: 26 Sep 92 22:20:41 GMT
Article-I.D.: husc3.1992Sep26.182041.15873
Organization: Harvard University Science Center

If you must lock-out a user without removing their directories,
eliminate all the system holes, which you should anyway, then change
the users shell to /bin/sync... that way they'll be doing you a minor
favor.

But all in all it seems easier to remove their directory to
some tar device, can the passwd line, and send them snail-mail to say
yer mad at them, or some script that prints this on the screen when
they try a log on...

If a user has done something heinous enough to deserve removal of
priviledges, then they should be removed. On the other hand, it
shouldn't be incredibly easy, because pretty soon someone will be
locking someone out is cause they made goo-goo eyes at the user
administrator's girlfriend.
From: kevin@cfctech.cfc.com (Kevin Darcy)
Newsgroups: comp.unix.shell
Subject: Re: how to skip last line in awk?
Date: 1 Oct 92 01:36:14 GMT
Organization: Chrysler Financial Corp., Southfield, MI

In article <1992Sep29.175322@is.morgan.com> holger@is.morgan.com (Holger Veith) writes:
>Hi,
>
>to simplify: lets say I have a column of number in ascii format.  I would like
>to subtract one from every number except on the last line.
>
>The actual problem is more difficult but basically I need to test if I am
>on the last line and NOT do something.
>
>     * is there a variable called LINES_IN_FILE which I could compare NR 
>	(which is the current line) to?

Not to my knowledge.

>     * this may be related to the FILENAME variable.

In what way?

>     * I guess I could set a variable to the wc (wordcount) of the file
>       in the BEGIN{} section, but that is not too efficient.

Forget putting it in the BEGIN section -- in order to do it that way, with 
most awk's I know, you end up having to allow shell-substitution, which means
you have to escape all of your awk code (for {, }, $n, etc.), and it just 
becomes a mess. Instead, pass in the variable on the command line. It's 
a lot cleaner. E.g. (to follow your simplification):

set -- `wc -l < /tmp/input_file`
awk '{
	if (NR == lines_of_input)
		print $1
	else
		print $1 - 1
     }' lines_of_input=$1 /tmp/input_file

>     * instead of printing a line I could set it to a variable and once
>       I read in the next line I could then print the variable (which would
>       be the previous line).  The END{} segment would then print the last
>       line.  This is sort of a pain-shift-the-login-in-the-file solution.

Yup. Unless you're REALLY hurting for file I/O bandwidth, I'd go with the 
"wc" solution. The total amount of CPU used is not likely to be much different 
between the two approaches, and the "staggered" version lands you with messy, 
incomprehensible, high-bug-potential awk code.

If you really ARE hurting for file I/O, then perhaps you could consider 
preprocessing your input by sed to stick in a sentinel value before the last
line, and triggering on that:

cat /tmp/input_file | sed '${
i\
!SENTINEL!
}' | awk '{
		if ($0 ~ /^!SENTINEL!$/) {
			at_end = 1
			next
		}
		if (at_end)
			print $1
		else
			print $1 - 1
	 }'

The downside, of course, besides a little kludginess, is having two processes 
running concurrently, with a pipeline between them...

------------------------------------------------------------------------------
kevin@cfctech.cfc.com 		  | Kevin Darcy, Unix Systems Administrator
...destroyer!cfctech!kevin 	  | Technical Services (CFC)
Voice: (313) 759-7140 		  | Chrysler Corporation
Fax:   (313) 758-8173 		  | 25999 Lawrence Ave, Center Line, MI 48015
------------------------------------------------------------------------------
From: dhami@cs.ubc.ca (Mandeep S Dhami)
Newsgroups: comp.unix.shell
Subject: Re: how to skip last line in awk?
Date: 6 Oct 1992 01:19:48 -0700
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
NNTP-Posting-Host: valhalla.cs.ubc.ca


How about:
{ Do something with lastline }
{ lastline=$0 }

as in:
$ awk '
> (NR>1) {print last}
> {last=$0}' <<EOF
> aaaa
> bbbb
> cccc
> EOF
aaaa
bbbb
$

Mandeep.
----------------------------------------------------------------------
Those who do not understand Unix are condemned to reinvent it, poorly.
                                                      -- Henry Spencer
----------------------------------------------------------------------
Newsgroups: comp.unix.shell
From: naren@cs.UAlberta.CA (Narendra Ravi)
Subject: Tcsh and Bash: any comparisons?
Organization: University of Alberta, Edmonton, Canada
Date: Tue, 6 Oct 1992 22:56:29 GMT


Hi: Has anyone had a chance to look at the differences in tcsh and bash?
From a cursory look, both seem to provide the same type of functions for
command-line editing, etc. Of course, bash probably doesn't provide a
facility to check for who is logged on.

I would appreciate if someone can post/mail a list of differences.

Thanks,


-- 

 -- Naren
    Narendra Ra[a]vi     Email : naren@cs.ualberta.ca
--

 -- Naren
    Narendra Ra[a]vi     Email : naren@cs.ualberta.ca
Xref: sparky comp.unix.shell:4173 comp.unix.questions:11653
Newsgroups: comp.unix.shell,comp.unix.questions
From: plobo@dvlseq.us.oracle.com (Patrick Lobo)
Subject: Re: Help with sysv bourne expr command
Summary: Fgrep can cause your problems.
Organization: Oracle World HQ, Redwood Shores, California
Date: Thu, 1 Oct 1992 04:43:39 GMT
X-Disclaimer: This message was written by an unauthenticated user
              at Oracle Corporation.  The opinions expressed are those
              of the user and not necessarily those of Oracle.

In article <5613@dsacg3.dsac.dla.mil> nrs2495 writes:
>What I am trying to do here is get a total count in megabytes, that these 
>certain filesystems take up.  Everything works fine, except for the "expr"
>line.  I just can't get it to add the cut material.  Does anyone see what
>I am doing wrong?  Or with bourne shell, is there another way of doing this?
>FSTOTAL=0
>dfspace2 > /tmp/dfspace2
>
>for FSYSTEMS in /rb /rm /usr2 /pcnfs /usr /r /rs /rr /inx / /ieps   
>do
>   # get the megabyte count from each filesystem 
>   FSONE=`cat /tmp/dfspace2|fgrep $FSYSTEMS' '|cut -c14-19`
>   # total the count up
>   FSTOTAL=`expr $FSONE + $FSTOTAL`  # syntax error 
>done
>echo $FSTOTAL
>
>here is a line from /tmp/dfspace2, spacing is not correct:
>
>/           :         11.68 MB  of   26.45 MB available  (44.15%).
>
>
>thanks, bill

Offhand, the fgrep returns more than one line when you run the script.

For example, when you fgrep for /usr you get the lines in /tmp/dfspace2
that contain the strings /usr and /usr2.  Worse still, when you fgrep for
/r you get the lines that contain strings /r. /rb, /rs, /rr.  This messes up
FSONE because FSONE is now not a single number in the expr command of your 
script, but a list of numbers without intervening + signs.  Thus, you expr
command becomes something like `expr 20 99 83 + $FSTOTAL` which causes it to
fail.

To grep for the string /r and have it return /r only (instead of /rb, /rs as
well)  use the regular expression \</r\> and so on.  Basically, you precede ot
with \< and follow it with \>.

Also, cut is probably not good to use here, because irregular spacing between
the fields may occur.  It is better to use awk to print out only the fields
that contain the number which will be added.

Patrick 
Newsgroups: comp.unix.shell,comp.unix.questions
From: edwardsk@cuug.ab.ca (Kenneth Edwards 268-6500)
Subject: Re: Help with sysv bourne expr command
Organization: Calgary UNIX Users' Group
Date: Thu, 1 Oct 1992 19:24:45 GMT

In article <5613@dsacg3.dsac.dla.mil> you write:
>FSTOTAL=0
>dfspace2 > /tmp/dfspace2
>
>for FSYSTEMS in /rb /rm /usr2 /pcnfs /usr /r /rs /rr /inx / /ieps   
>do
>   FSONE=`cat /tmp/dfspace2|fgrep $FSYSTEMS' '|cut -c14-19`
>   FSTOTAL=`expr $FSONE + $FSTOTAL`  # syntax error 
>done
>echo $FSTOTAL
>
>here is a line from /tmp/dfspace2, spacing is not correct:
>
>/           :         11.68 MB  of   26.45 MB available  (44.15%).
>

Well I don't see what is wrong with your script - have you tried echoing
FSONE before expr to see what it has in it. It may be that it has two
arguments and is confusing expr.  However there would seem to be ways 
of doing this that use a lot less resource.  Consider:

I don't have dfspace but df takes arguments.

df /rb /rm /usr2 /pcnfs ... | awk '{ sum+=$4 }END{ print sum * 512, " bytes"}'
Organization: Stanford Linear Accelerator Center
Date: Monday, 28 Sep 1992 12:09:07 PST
From: <CATHIE@SLACVM.SLAC.STANFORD.EDU>
Newsgroups: comp.unix.shell
Subject: REXX for Unix

Since there are three free versions of REXX for Unix, some of you may be
interested in the next REXX Symposium.  We hope to have another discussion
of REXX, Perl, and other scripting languages.  Please distribute the
following information:

Announcement and Call for Participation

REXX Symposium for Developers and Users
18-20 May 1993
San Diego, California

The REXX Symposium provides a forum for information and ideas and an
opportunity to interact personally with others interested in using and
enjoying programming in REXX.

The Symposium consists of plenary sessions and parallel sessions for papers,
status reports, and review talks.  Presentations focus on using REXX on a wide
variety of computing platforms and operating systems.  Of particular interest
are unique applications, REXX tools and function libraries, REXX interfaces
with other languages, user support, and education.  Author Mike Cowlishaw and
other implementors will be present and participate in the sessions.

Abstracts of proposed contributions should be clear and about one page long.
Talks will 20 to 45 minutes.  A paper may be submitted for a poster
session (that is, pages of paper pinned to a wall to be read individually).

Please send the abstract by 1 December 1992 to

                       Cathie Dager
                       SLAC
                       P.O. Box 4349, MS 97
                       Stanford, CA  94309  USA

     or by e-mail to cathie@slacvm.slac.stanford.edu

Contributors will be informed of acceptance no later than 1 March 1993.
Symposium proceedings will include all invited talks and contributed papers.

Special hotel rates have been negotiated for this Symposium if reservations
are made through Village Travel in Palo Alto, CA by 1st April 1993.

Fee schedule:
     Conference    --  US$300 includes 3 meals, socials, proceedings
     Lodging/Night --  US$85  single or double

Registration is required.  The registration fee is due in advance, payable
in cash or check, net US$300 in US funds.  To register for the Symposium,
reserve a room, and make travel arrangements, please contact:

                       Village Travel
                       REXX Symposium
                       69 Town and Country Village
                       Palo Alto, CA  94301  USA
                       1-800-245-3260
                       1-415-326-0510  fax 1-415-326-0245

Please send questions to any member of the program committee:

     Cathie Dager      cathie@slacvm.slac.stanford.edu
     Forrest Garnett   garnett@vnet.ibm.com
     Jim Weissman      jhw@cup.portal.com
     Bebo White        bebo@slacvm.slac.stanford.edu

Cathie Burke Dager   cathie@slacvm.slac.stanford.edu   415-926-2904
---> the opinions expressed are mine alone and not necessarily those
     of SLAC, Stanford University or the DOE
---> REXX for DOS, OS/2, Windows, NT, Mac, Amiga, Tandem, Unix, VM, MVS, TSO
Newsgroups: comp.unix.shell
From: dwhopkin@vela.acs.oakland.edu (Dave Hopkins)
Subject: Re: suppressing the screen message when backgrounding
Organization: Oakland University, Rochester MI.
Date: Tue, 29 Sep 1992 14:57:42 GMT

djbpitt+@pitt.edu (David J Birnbaum) writes:

>When I enter a background command (using a postposed ampersand), the
>shell obligingly gives me the job and process numbers. How can I
>suppress this display? I am using tcsh and Ultrix.
>
>Thanks,
>
>David

The trick is to redirect the standard error output of the _shell_ itself.
In Bourne/Korn, this is done via the following.
	( command & ) 2>/dev/null
	        - or -
	( command >file & ) 2>/dev/null

In csh/tcsh, the following appears to work.
	( command & )
	        - or -
	( command >file & )

Hope this helps,

Dave Hopkins
dwhopkin@vela.acs.oakland.edu

Xref: sparky comp.unix.shell:4212 comp.unix.programmer:4879 alt.binaries.pictures.d:4726 sci.space:14071