HDTenEightyP/NetNews huggingface dataset:
From: jca@fjtla.att.com (54628-J. Antrosiglio,3D122(HOK093)T320)
Subject: Re: ksh, ftp, sun problem
Reply-To: jca@fjtla.att.com
Organization: AT&T
Date: Fri, 10 Apr 1992 12:35:07 GMT
Originator: jca@fjtla

From article <1992Apr9.132448.15304@cbnewsm.cb.att.com>, by ortcm@cbnewsm.cb.att.com (thomas.mcguigan):
> Help!  I just set ksh as my login shell on the Sun SPARCStation I use.  Now
> I find that I cannot ftp INTO the workstation - error message: Access
> Denied.  FTP out of the workstation works fine.  Has anyone else seen this
> problem?  Any suggestions on remedies (other than dropping ksh or running all
> ftp jobs from th workstation)?
> 
> Thanks for any help anyone can provide.
> 
> Tom McGuigan
> thomas.mcguigan@att.com

Make sure you have included the name of your login shell in /etc/shells.
The ftp daemon will only allow user's with non-standard shell access to
the system if the non-standard shell is listed in /etc/shells. Make sure
you put the full to the shell in this file.

John

-- 


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Newsgroups: comp.unix.shell
From: willr@ms.uky.edu (William Rodgers)
Subject: Question with keeping directory after ksh script
Keywords: ksh, cd, don't change bck
Summary: ARGH
Date: Thu, 9 Apr 1992 00:46:05 GMT
Organization: University Of Kentucky, Dept. of Math Sciences
X-Bytes: 

I've written a short script to help implement a directory structure with
a commonly used root.  in other words.

                          / (normal root directory)
                  local        users  (other directories)
           willr  risner blah             (operator directories)
      Lib .. ... ....                     (My directories)
    Compat ..                             (Subdirs)

Ok, so here's the deal.  In /local/willr/Lib/Compat, there is a huge
subset of directories.  What I want to do is type something like
ccd (compat cd) to change to /local/willr/Lib/Compat with no args,
or to /local/willr/Lib/Compat/$1 with one arg.

I wrote this script....

#!/bin/ksh

# Allow movement around the compat src.

if (( $# == 1 )) 
then
   if [[ -d /local/willr/Lib/Compat/$1 ]]
   then
      cd /local/willr/Lib/Compat/$1
   else
      echo "Not a directory <-> /local/willr/Lib/Compat/${1}."
   fi
elif (( $# == 0 )) 
then
   cd /local/willr/Lib/Compat
else
   echo "Invalid arguments to mccd."
fi
 

The problem is, as you can guess, that while it runs the program, it does
the cd just fine, but when it bops out/exits, it returns me to where I was
before I ran the script.   I hate this parent->child one-way thang.

The machine is a 3b2, running SysV 3.2.2, kshell version 06/03/86b

I know, don't gag. it's paid for.

William Rodgers
From: alien@hpdmd48.boi.hp.com (Tom von Alten)
Newsgroups: comp.unix.shell
Subject: Re: Deleting alternate lines
Date: 8 Apr 92 23:21:30 GMT
Organization: Hewlett Packard - Boise, ID

I don't know how widespread HP's improved version of awk (nawk) is,
but on my hp-ux 7.05 system, the following works for me:

nawk 'NR%2' foo		# prints odd numbered lines
nawk '!NR%2' foo	# prints even numbered lines

It doesn't work for awk without stuff like previously posted.
_____________________
Tom "terse" von Alten
Newsgroups: comp.unix.shell
From: pfalstad@phoenix.Princeton.EDU (Paul Falstad)
Subject: Re: appending a single quote
Originator: news@ernie.Princeton.EDU
Organization: League For Fighting Chartered Accountancy
Date: Sat, 11 Apr 1992 03:33:37 GMT

gwilliam@crc.ac.uk (Gary Williams x3294) wrote on 9 Apr 92 15:09:47 GMT:
>In article <1992Apr9.122221.5509@crc.ac.uk> gwilliam@crc.ac.uk (Gary Williams x3294) writes:
>>	    -e "s/$/\'/" \	# append a ' (** THIS DOESN'T WORK **)

>I have a workaround. It is horrible, but much of shell programming is :-)

Yes, but not this bad, fortunately.

>set dollar = '$'
>alias | sed -e 's/\!/\\\!/g' \
>	    -e 's/^/&alias /' \
>	    -e "s/	/	\'/1" \
>	    -e "s/$dollar/\'/" \

That's silly.  Just quote the $ properly, using single quotes instead of
double quotes.  You don't need the extra variable.

		 -e 's/$/'"'/"

or

		 -e 's/$/'\'/

or

		 -e s/\$/\'/

or, in rc (shocked that no one has posted this yet :-) )

		 -e 's/$/''/'

or use the better version, which Kartik posted.  Or use a real shell, which
doesn't choke on "$/".  But the "set dollar" hack is ugly; quoting rules
are not that difficult.

-- 
Paul Falstad, pfalstad@phoenix.princeton.edu | 10 PRINT "PRINCETON CS"
[Your blood pressure just went up.]          | 20 GOTO 10
From: jlbrand@pb2esac.UUCP (Jack Brand)
Newsgroups: comp.unix.shell
Subject: Re: Running a script with execute only permission?
Date: 14 Apr 92 06:22:20 GMT
Reply-To: jlbrand@pb2esac.UUCP (Jack Brand)
Organization: Pacific*Bell ESAC, Oakland, Ca.

In article <q!xjw+g.daf@netcom.com> daf@netcom.com (Douglas Forman) writes:
>I am a new UNIX user who must also perform system 
>administration duties with a problem.
>I have a script that I want other users to execute, but I don't
>want them to be able to read it.
>But when another user tries running a script that has 711
>privaleges, the script file cannot be found.

Correct.  A shell program is not truly an "executable" program in
the pure sense, as an executable compiled C program, for example, is.
The user's shell reads and interprets the commands in a "shell script".  If
the file is not readable via the normal permissions, a user's shell
cannot interpret it.

>Is there way to make a KornShell script run that can be
>run by other users, without giving read privalege to that
>user?  

Indirectly, yes.  One kludge would be to have a set-uid C program
interface that would execute the shell program.  That way the shell
program could remain unreadable by the user, but the user would
temporarily be "boosted up" to another UID by the C program in order
to run the shell program.  (This approach can open a fairly large
security can of worms, however - tread carefully.)

I think the important questions to ask are: why is it that users on 
your system aren't allowed to read this shell script?  Presumably
you do not want them knowing what commands/files they are accessing,
although they must already have permission to access them (otherwise the
shell program wouldn't work)?  This is dubious security at best,
if that's what it is.  Eventually users will find what it is you are
attempting to hide from them by not making the shell script readable.
If it is *truly* something that needs protection, give it decent
protection via a secure program.  The obvious example of this is
the "passwd" command which is a secure way for users to modify
their entry in the /etc/passwd file.  No one would dream of having
a shell script available to modify the /etc/passwd file but pretend
that if the users cannot read the script everything is safe.

If it is not an issue of security, why not let the users see what you
are doing in your script?  Of course I know nothing about your user
population, but often the more open the system the more trust you
can have in your users and the more they will have in you.  Few
things are more irritating to a user population than the feeling the
system administrator is hiding things unnecessarily.  Who knows,
your users may give you improvements to your script if allowed to
read it! :-)

Again, if it is security you need, do NOT rely on users not knowing
what commands/files are at their disposal yet - it won't last.

jb
From: rantapaa@s6.math.umn.edu (Erik E. Rantapaa)
Newsgroups: comp.unix.shell
Subject: Maintaining .cshrc files across several machines
Date: 8 Apr 92 21:37:42 GMT
Article-I.D.: s6.rantapaa.702769062
Organization: University of Minnesota

Has any one solved the problem of maintaining .cshrc files across
several machines?  In particular, it would be nice to have a
'cshrc-config' program which would sniff out a system for binary
paths, libraries, etc.



--
Erik Rantapaa                              rantapaa@math.umn.edu
From: ratinox@meceng.coe.northeastern.edu (Richard Pieri/Stainless Steel Rat)
Newsgroups: comp.unix.shell
Subject: Re: Why doesn't this work (sh) and what's the (t)csh version?
Date: 17 Apr 92 02:10:14 GMT
Article-I.D.: splinter.RATINOX.92Apr16221014
Reply-To: ratinox@meceng.coe.northeastern.edu
Organization: 3WA, Boston Office. Or Nu Meta Chi. Take your pick.
In-reply-to: def2@engr.uark.edu's message of 16 Apr 92 04:47:08 GMT
X-Signature-Virus-Protection: Version 1.51
X-Quote: "Just once, I wish we would encounter an alien menace that wasn't
X-Quote: immune to bullets." -- Brigadier Lethbridge Stewart, "Dr. Who"
X-Posting-Software: GNUS 3.14.1 [ NNTP-based News Reader for GNU Emacs ]

>>>>> On 16 Apr 92 04:47:08 GMT, def2@engr.uark.edu (Don Faulkner) said:

def2> Ok, here's the scoop: I'm running screen and need to see at each login
def2> if it's already running. I tried this:

[worthless code]

def2> What's the problem? I'm lost. BTW, I'm just a *little* unfamillar
def2> with shell programming, but this is the only way (it goes in either
def2> .cshrc or .login). Also, what do I need to do to get this sort of
def2> thing to work under tcsh?

Ok. There are two possibilites 1) screen has a detached process you wish
to reconnect to, 2) no screen process running. In C-Shell:

ps x | grep -i '[0-9] screen' >/dev/null
if ( $status == 0 ) then
    screen -r	# resume screen
else
    screen	# start screen
endif

I use something almost identical to this in my .login (but with a small
perl script that asks before starting screen up--the script isn't mine, so
I can't really post it).

--Rat
--
||||| | | | |  |  |  |   |   |    |    |    |   |   |  |  |  |  | | | | | |||||
                                                   __        ___ 
Richard Pieri, Northeastern's Stainless Steel Rat/   | /| / /   | The Worlds
Internet: ratinox@splinter.coe.northeastern.edu /__  |/ |/ / /| | Welfare Works
    UUCP: ...!northeastern.edu!splinter!ratinox/   | /| / / / | | Association:
  BITNET: UA_RLP@NUHUB{.BITNET}               /__  |/ |/ / /  | | I will solve
  USNail: 14 Westdale RD  Holbrook, MA 02343 /   | /| / / /___| | any problem
 ICBMnet: 42 deg 1 min N, 71 deg 0 min W    /    |/ |/ /_//_____| for you.
Newsgroups: comp.unix.shell
From: jik@athena.mit.edu (Jonathan I. Kamens)
Subject: Re: Changing the ESC code for a session...
Organization: Massachusetts Institute of Technology
Date: Thu, 9 Apr 1992 21:45:49 GMT

In article <12065@tamsun.tamu.edu> cmwhelp@tamsun.tamu.edu (Christopher Walton) writes:

   Is there a way to change what my escape charater "^[" is defined as for a
   single session?

Define "session."  Define "escape character."  Do you mean the escape
character that tcsh (or whatever your shell is) uses for command
prefixes?  Do you mean EMACS's escape character?  Do you mean the
escape character that telnet uses?  What exactly are you talking
about?

-- 
Jonathan Kamens						jik@MIT.Edu
MIT Information Systems/Athena		    Moderator, news.answers
    (Send correspondence related to the news.answers newsgroup
	{and ONLY correspondence related to the newsgroup}
		 to news-answers-request@MIT.Edu.)
Newsgroups: comp.unix.shell
From: jpglori@srv.PacBell.COM (John P. Gloria)
Subject: WORD (4.0) convert to Postscript 
Organization: Pacific * Bell
Distribution: comp.sys.mac.apps
Date: Thu, 16 Apr 1992 06:17:48 GMT

Many thanks to everyone who responded to my question on how to
convert a WORD document to Postscript. : ) 
-- 
        ********     John Gloria - jpglori@pacbell.com	********	
 "Rather than love, than money, than fame, give me truth."
										- Henry David Thoreau

Newsgroups: comp.unix.shell
From: jik@athena.mit.edu (Jonathan I. Kamens)
Subject: Re: ksh, ftp, sun problem
Organization: Massachusetts Institute of Technology
Date: Thu, 9 Apr 1992 21:44:03 GMT

From the ftpd(8) man page:

     Ftpd authenticates users according to three rules.

     ...

     3)   The user must have a standard shell returned by
          getusershell(3).

From the getusershell(3) man page:

     Getusershell returns a pointer to a legal user shell as
     defined by the system manager in the file /etc/shells.  If
     /etc/shells does not exist, the two standard system shells
     /bin/sh and /bin/csh are returned.

In other words, if the shell you're using is not in /etc/shells (or,
if you're using NIS on your Sparc and the shell isn't in the NIS
shells database), you can't log in using ftp.  Add the shell to
/etc/shells.

-- 
Jonathan Kamens						jik@MIT.Edu
MIT Information Systems/Athena		    Moderator, news.answers
    (Send correspondence related to the news.answers newsgroup
	{and ONLY correspondence related to the newsgroup}
		 to news-answers-request@MIT.Edu.)
From: boyd@prl.dec.com (Boyd Roberts)
Newsgroups: comp.unix.shell
Subject: Why csh is not my favourite programming language...
Date: 15 Apr 92 10:31:31 GMT
Organization: Digital Equipment Corporation - Paris Research Laboratory


    prl313 10% unset gore
    prl313 11% set x = y
    prl313 12% if ( "$x" == "" ) echo ping
    prl313 13% if ( "$x" == "" ) set pus = $gore[5]
    gore: Undefined variable.
    prl313 14% set gore
    prl313 15% if ( "$x" == "" ) set pus = $gore[5]
    Subscript out of range.

Just marvellous isn't it?  The test fails but csh _evaluates_ the
assignment it's not going to execute.  Methinks the lexical analyser
is getting above its station.

How about we try:

    prl313 16% unset gore
    prl313 17% set x = y
    prl313 18% if ( "$x" == "" ) then
    ? echo ping
    ? endif
    prl313 19% if ( "$x" == "" ) then
    ? set pus = $gore[5]
    ? endif
    prl313 20%

Nice, isn't it?


Boyd Roberts			boyd@prl.dec.com

``When the going gets wierd, the weird turn pro...''
From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao)
Newsgroups: comp.unix.shell
Subject: Re: appending a single quote
Date: 9 Apr 92 17:45:50 GMT
Article-I.D.: Princeto.1992Apr9.174550.14696
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');

In article <1992Apr9.152736.26082@Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Subbarao) writes:
>In article <1992Apr9.122221.5509@crc.ac.uk> gwilliam@crc.ac.uk (Gary Williams x3294) writes:
>
>>alias cmd	'do things \!*'
>>
>>It is obvious why the offending sed command doesn't work - but can
>>anyone see a way to work around the problem?
>
>Hmm. Here is something that does what you basically want:
>
>% alias | perl -ne 's/\\!/\\\!/g; $_ =~ "(.*)	(.*)$";  \
>  print "alias $1 '\''$2'\''\n"'
>
>(note: is a TAB character between the (.*) and the (.*)$ in the regexp).
>
>But this doesn't handle quotes inside of an alias though...

But this does, as Paul pointed out to me:

% alias | sed -e 's/[\!'\'']/\&/g' -e 's/^\([^	]*\).\(.*\)/alias \1 '"'\2'/"

Ugh.

	-Kartik
From: davis@en.ecn.purdue.edu (Robert E Davis)
Newsgroups: comp.unix.shell
Subject: Re: Having stty command in .cshrc for xterm.
Date: 7 Apr 92 05:00:58 GMT
Organization: Purdue University Engineering Computer Network

In article <72975@netnews.upenn.edu> hseung@retina.anatomy.upenn.edu (Hyunsuk Seung) writes:
>
>I need to use the stty command to initialize/customize my environment
>under xterm, but putting the command in .cshrc conflicts with my rsh
>(or rcp) commands invoked from other machines.  Is there a clever way
>to get around this problem (besides manually typing it or using
>alias)?  Xterm reads only .cshrc file and not .login file.

	Start up xterm with the -ls option, which tells it to start
the shell as a login shell so that it will read your login files.
Keep the stty stuff in the .login.


Robert
-- 
| Robert Davis
| davis@sonata.cc.purdue.edu                                NeXT Mail accepted
| "Look up, Hannah.  Look up." 
--
Newsgroups: comp.unix.shell
From: boyd@prl.dec.com (Boyd Roberts)
Subject: Re: help with shell scripts (csh)
Organization: Digital Equipment Corporation - Paris Research Laboratory
Distribution: usa
Date: Wed, 15 Apr 92 20:15:10 GMT

In article <1992Apr14.183047.3019@magnus.acs.ohio-state.edu>, janantha@magnus.acs.ohio-state.edu (Jayanth N Anantharaman) writes:
> I am trying to write a shell script in csh.

Word of advice:  Don't.


Boyd Roberts			boyd@prl.dec.com

``When the going gets wierd, the weird turn pro...''
From: yoongc@syma.sussex.ac.uk (Yoong Hon Chong)
Newsgroups: comp.unix.shell
Subject: Re: How to set meta key for tcsh
Date: 13 Apr 92 13:22:40 GMT
Organization: University of Sussex

In article <1992Apr7.221340.29288@auto-trol.com>, jamwil@auto-trol.com (James Wilmsen) writes:
> I would like to define the meta key to replace esc key for tcsh
> commands, as in emacs.  I have a sun sparc style keyboard and would
> like to define the diamond marked key between the space and alt as the
> meta key for emacs style editing.  I am not sure if I need to use some
> stty command or need to set to a particular terminal emulation.  Any
> help would be appreciated.
> 

Put the script below in your .login or /etc/login and things should be
okay :-)

------------------- 
    if ( $?prompt ) then
        if ( "`echotc meta`" == "yes" ) then
             stty pass8
        endif
    endif
-------------------
Have fun...

Chris
--


-- 
===============================================================================
Chris Y H Chong - Comp.Sc. 		Internet: yoongc@central.susx.ac.uk
University Of Sussex				  yoongc@cogs.susx.ac.uk
United Kingdom					  yoongc@syma.susx.ac.uk
Newsgroups: comp.unix.shell
From: supergau@opal.cs.tu-berlin.de (Thipor Kong)
Subject: Re: Having stty command in .cshrc for xterm.
Organization: ZRZ/TU-Berlin
Distribution: fb20
Date: Tue, 7 Apr 1992 08:03:18 GMT

davis@en.ecn.purdue.edu (Robert E Davis) writes:

>>I need to use the stty command to initialize/customize my environment
>>under xterm, but putting the command in .cshrc conflicts with my rsh
>>(or rcp) commands invoked from other machines.  Is there a clever way
>
>	Start up xterm with the -ls option, which tells it to start
>the shell as a login shell so that it will read your login files.
>Keep the stty stuff in the .login.

Use the XTerm*ttyMode-Resource and put there your stty-Options
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                       supergau@cs.tu-berlin.de
From: davidsen@yeti.crd.GE.COM (william E Davidsen)
Newsgroups: comp.unix.shell
Subject: Re: Wanted:  Generate sequential file names
Date: 16 Apr 92 17:42:56 GMT
Reply-To: davidsen@crd.ge.com (bill davidsen)
Organization: GE Corporate R&D Center, Schenectady NY

In article <1992Apr14.020643.1498@candle.uucp>, root@candle.uucp (Bruce Momjian) writes:
|  Does anyone have a nifty bourne shell script which turns filenames like: 
|  
|  	fred003	 	into 	fred004
|  	barney06	into	barney07
|  
|  and so forth?  It should work for a variable number of zeros.  I want to
|  use this for keeping log files.

Assuming that you want to keep the number of digits constant, you can
say:
    #!/bin/sh
    #
    # shell script to increment a filename with leading zeros
    # Bill Davidsen, davidsen@crd.ge.com, April 1992
    
    # get the base part of the name (assume format XXXX####, X is non-digit)
    basept=`expr $1 : "\([^0-9]*\)"`
    # get the number
    numval=`expr $1 : "$basept\([0-9]*\)"`

    # now force a 10 on the front to save the zeros, add 1, and delete the
    # leading one and next digit to leave zeros again. This insures a clean
    # wrap (from 999 to 000) again
    numval=`expr 10${numval} + 1`
    numval=`expr $numval : "1.\([0-9]*\)"`

    # print the parts as a whole filename again
    echo ${basept}${numval}

Note that solutions which add any fixed number will eventually overflow,
so the more cumbersome but robust mixed string and numeric method was
used.

As a final thought, since you are using these for log files, why not use
the partial julian date from 'date' as the fileanme?
	pdj=`date +%j`
Unless you keep you logs for more than a year this works fine. Most of
my logs die in a week or less, so I just use the one digit day of the
week to be part of the filename, and overwrite weekly.
-- 
	- bill davidsen (davidsen@crd.ge.com)
	GE Corp. R&D Center; Box 8; Schenectady NY 12345
By analysis of usenet source, the hardest part of C to use is the comment
From: cmwhelp@tamsun.tamu.edu (Christopher Walton)
Newsgroups: comp.unix.shell
Subject: Changing the ESC code for a session...
Date: 9 Apr 92 16:05:20 GMT
Organization: Texas A&M University, College Station

Is there a way to change what my escape charater "^[" is defined as for a
single session?

cmwhelp
From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
Newsgroups: comp.unix.shell
Subject: Re: HELP
Keywords: grep egrep fgrep
Date: 10 Apr 92 01:27:21 GMT
Organization: Unix in NYC

In article <854@wcsn.csms.com> ken@wcsn.csms.com (Kenneth D. Fox WCSN Sr. Operations Engineer) writes:
>I have a file named Day.open
>I would like to remove all lines that DO NOT contain
>the following words XMISN XMITR COAX

 
 egrep -v 'XMISN|XMITR|COAX' Day.open
-- 
Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160,1341
From: dsbarr@modula.cs.psu.edu (Dave Barr)
Newsgroups: comp.unix.shell
Subject: Re: 2 quick questions...
Date: 15 Apr 92 03:51:02 GMT
Reply-To: dsbarr@cs.psu.edu
Organization: Penn State Computer Science
Bcc: gasser@eniac.seas.upenn.edu

In article <73939@netnews.upenn.edu> gasser@eniac.seas.upenn.edu (Nathan Gasser ><>  ) writes:
>aren't broken?  Sorta like fold, except don't break words.
>

try fmt(1)

--Dave
-- 
Dave Barr            | -- NewsGrazer, a NeXTstep(tm) news reader, posting --
dsbarr@cs.psu.edu    | NOT!
Newsgroups: comp.unix.shell
From: jimr@col.hp.com (Jim Rogers)
Subject: Re: Question with keeping directory after ksh script
Date: Thu, 9 Apr 1992 19:39:31 GMT
Organization: HP Colorado Springs Division

The answer is not to use a script.  Use a ksh function instead.
I had a similar need a while back and created the following function:

function cdw
{
if [ $# -eq 0 ]
then
	cd ~
else
if [ -d $1 ]
then
	cd $1
else
	a=`whence $1`
        b=${a%/$1}
        echo "${1} in: ${b}"
	cd ${b}
fi
fi
}

This function either does a normal cd (if no argument is supplied, or the
supplied argument is a directory), or takes the value from whence for the
argument, determines the directory from the whence output, and cd's to that
directory.  Thus, if I wanted to look around in the directory from which I
executed the command lp I would issue the command "cdw lp".

The reason the function works is that it executes in your current shell.

-- 
Jim Rogers
Hewlett-Packard Company

jimr@col.hp.com
Newsgroups: comp.unix.shell
From: navarra@casbah.acns.nwu.edu (John Navarra)
Subject: Re: Why doesn't this work (sh) and what's the (t)csh version?
Organization: Northwestern University, Evanston, Illinois
Date: Thu, 16 Apr 1992 20:15:18 GMT

In article <1992Apr16.044708.13903@engr.uark.edu> def2@engr.uark.edu (Don Faulkner) writes:
>Ok, here's the scoop: I'm running screen and need to see at each login
>if it's already running. I tried this:
>
>scr = ps | grep -c screen
>if ( $scr >= 2 ) then
>   #screen is running (1 for screen, 1 for grep screen)
>   #so ignore the rest
>fi
>
>Any ideas would be *GREATLY* appreciated.

	Well, here's an idea: why don't you just test the exit status
of 'screen -r'? If if comes back and says, "there is no screen to be
resumed" then you obviously aren't running screen so you can just
issue a screen command and foregot the ps | grep stuff.
	A problem arises if you are already attached to a screen. Screen
-r won't reattach to an already attached screen so what I usually do
when this happens is issue a "kill -HUP pid" and then a screen -r and
things work out then. You can deal with thing scenario in some manner.

I don't have time to be more explicit with the coding right now so
if you can't figure this out, let me know and I will try writing some
script to do it.

-tms


-- 
From the Lab of the MaD ScIenTiST:
					
navarra@casbah.acns.nwu.edu		
Newsgroups: comp.unix.shell,comp.unix.aix