HDTenEightyP/NetNews huggingface dataset:
From: mju@mudos.ann-arbor.mi.us (Marc Unangst)
Newsgroups: comp.unix.shell
Subject: Re: How to make Restrict Shell more safely?
Date: 5 Jan 1993 01:55:35 -0500
Organization: The Programmers' Pit Stop, Ann Arbor MI
NNTP-Posting-Host: mudos.ann-arbor.mi.us

In article <1993Jan4.200035.7840@crd.ge.com> davidsen@crd.ge.com (bill davidsen) writes:
>Followups please note any major holes in this (I've run it for years, so
>I probably have a fix I didn't mention).

Hmm.  Is vi part of the /guest/bin environment?  If so, all the user
has to do is "vi foo", then do ":set shell=/bin/sh" and ":!/bin/sh".
Presto, they have an unrestricted shell.

-- 
Marc Unangst, N8VRH         | "Of course, in order to understand this you
mju@mudos.ann-arbor.mi.us   |  have to remember that the nucleus of the atom
                            |  is squishy."
                            |    -W. Scheider, from a Physics lecture
From: bet@sbi.com (Bennett Todd @ Salomon Brothers Inc., NY )
Newsgroups: comp.unix.shell
Subject: Re: ksh 1, perl 2 - ksh or perl for scripting?
Date: 5 Jan 93 03:46:12 GMT
Organization: Salomon Brothers, Inc.

Actually, when it comes to clarity of code, I think Perl wins over sh or C,
precisely because there are more ways to do a thing. I try to make code
visually clear [at least to me:-]. I try to adjust the functional
organization and layout of the source code to reflect the logical
description of what it's doing; the more choices I've got in flow-of-control
constructs the better. I find the combination of Perl's named blocks, the
``next LABEL'' and ``last LABEL'', and the pattern matching against the
default match space $_, to work particularly well for many programs I write.

I'm also a big fan of top-down design and bottom-up implementation, and I
find Perl's package system of namespace management to be very comfortable
and natural for the job. I can implement reusable packages to implement the
trickier lower-level functionality, starting with a spec for the interface
to the package. Then I can debug the package with simple test drivers, or
even calling it interactively from ``perl -de 0'' in a JOVE interactive
shell window. Once the package is all set I can use its external entry
points as a new collection of primitives to write the next higher level of
functionality. I've enjoyed good code reuse with this approach.

-Bennett
bet@sbi.com
Newsgroups: comp.unix.shell
From: Gary.Moh@launchpad.unc.edu (Gary Moh)
Subject: book on shell programming
Organization: UNC Office of Information Technology
Date: Mon, 4 Jan 1993 17:10:14 GMT

Could someone recommend a couple of books on shell programming
please??  I know a little already, but I don't want to go 
through the man pages everytime I program.
Any response is appreciated.

Gary Moh
gmoh@csnext.colgate.edu
gmoh@colgate.edu


--
   The opinions expressed are not necessarily those of the University of
     North Carolina at Chapel Hill, the Campus Office for Information
        Technology, or the Experimental Bulletin Board Service.
           internet:  laUNChpad.unc.edu or 152.2.22.80
From: jhgreen@cs.sandia.gov (Jethro H. Greene)
Newsgroups: comp.unix.shell
Subject: Re: File Problem.
Date: 9 Jan 93 00:58:21 GMT
Distribution: comp
Organization: Sandia National Laboratories, Albuquerque, NM

In article <WRASMAN.93Jan8164326@duncan.utkcs> wrasman@duncan.utkcs (Mirror Mirror on the wall) writes:
>I seem to have accidently created a file that starts out with
>a - . I can't get rm to get rid of it and I can mv to another file
>name. SO does anyone know how to get rid of a file like this.

The shell thinks that when you type '-', you are giving the command options.
You can either do:

	rm ./- 
		--or--
	rm - -

(The UNIX FAQ list would have been a good place to start.)

-- 
Jethro H. Greene
Massively Parallel Computing Research Laboratory,
Sandia National Laboratories, Albuquerque, New Mexico
From: sbpress@libws4 (The Stony Brook Press)
Newsgroups: comp.unix.shell
Subject: Re: BASH info wanted
Date: 11 Jan 93 03:22:49 GMT
Reply-To: sbpress@ic.sunysb.edu
Organization: The State University of New York at Stony Brook
X-Newsreader: Tin 1.1 PL4

bgitv@termo.unit.no (Bard Grimsmo) writes:
: In article <6681@pdxgate.UUCP> henk@rigel.cs.pdx.edu (David C. Henkemeyer) writes:
: >I recently converted from csh to BASH, and I was looking for some good sources
: >of information (besides the man page, which I have) for getting me going in my
: >ne shell...  I'd appreciate any suggestions, or an FAQ file if one exists...
: >
: I dont think you will find any (If you do please mail it to me!). Bash
: is very close to ksh (Korn Shell) and sh, and you will find all you need in
:me too
--
signature:  		THE STONY BROOK PRESS
The State University of New York at Stony Brook Community's Feature Newspaper
		" All the News That's Not Printed to Fit. "
Snailnet: The Stony Brook Press   |  internet: sbpress@ic.sunysb.edu  
	  S.U.N.Y. at Stony Brook |  bitnet : sbpress%ic.sunysb.edu@cunyvm
          Stony Brook N.Y. 11794  |  Voicenet : (516) 632-6451
alternate e-mail(if sbpress@ic... doesn't work): dglasner@ccmail.sunysb.edu
From: mireley@arnou.cem.msu.edu.brewery (John D. Mireley)
Newsgroups: comp.unix.shell
Subject: SYS V lp interface script
Date: 6 Jan 1993 13:10:54 GMT
Organization: Michigan State University Department of Chemistry
Distribution: world
Reply-To: mireley@arnou.cem.msu.edu.brewery
NNTP-Posting-Host: arnou.cem.msu.edu


I am trying to modify a lp interface script on an AT&T
3B2-400 (SYS V r 3.1) to copy (rcp) a file to a SPARC and 
print it using lpr. The rcp works fine put the remsh
from the 3B2 will not execute the lpr request on the Sun.
In fact, I don't think it will execute anything. The script
works when I "su" to lp and run it but fails when run through
lpsched.

I know that I've done this 3B2 to 3B2.

What am I missing?.


John Mireley
Xref: sparky comp.unix.shell:5244 comp.unix.programmer:5824
From: bhoughto@sedona.intel.com (Blair P. Houghton)
Newsgroups: comp.unix.shell,comp.unix.programmer
Subject: Re: A quoting problem.
Date: 5 Jan 1993 00:40:30 GMT
Organization: Intel Corp., Chandler, Arizona
Distribution: world
NNTP-Posting-Host: stealth.intel.com
Keywords: SVR4, Bourne shell, quoting filenames.

In article <lkh5trINNvf@exodus.Eng.Sun.COM> richb@stard.Eng.Sun.COM (Rich Burridge) writes:
>strcpy(cmd, "FILES='file file1 file2';export FILES;rm $FILES") ;
>...
>execl("/bin/sh", "sh", "-c", cmd, (char *) 0) ;
>...
>Now the problem is how to correct quote the "cmd" string to handle all
>possible filenames. Can this be done?

Not trivially.

Since you're sending the output to the shell your program
has to be as smart as you would have been had you typed the
command-line to the shell yourself.

That is, the program would have to put a backslash in all
the proper places in filenames that require escaped characters.

The simplest way to do this would be to put a backslash in
front of every character, but you then conflict with C's
interpretation of certain escape sequences within strings
(e.g., "\n" and "\"").

That is, sometimes it takes two backslashes, sometimes one,
but most of the time none.

				--Blair
				  "That depends..."
Newsgroups: comp.unix.shell
From: anthony@kurango.cit.gu.edu.au (Anthony Thyssen)
Subject: Re: How to make Restrict Shell more safely?
Organization: Griffith University.
Date: Thu, 7 Jan 1993 03:35:10 GMT

wvarga@gmuvax2.gmu.edu (Wilson Varga) writes:
| There is a commercial product, CENTRUS UX, that solves all of this by
| keeping end-users within a menu system.  What the resrticted class of
| end-users is permitted to do/not do is entirely under the control of
| the system administrator.  Access to any of the unix shells is also
| effectively eliminated, without restricting the functionality of
| applications such as vi.  Contact the company directly for more
| information.  I know that CENTRUS is currently available for HP-UX, but
| the company is seeking to compile for other versions of unix.
| Contact uss@uii.com.

  If you are runing X windows. You can very easly provide a `guest'
account.  Just setup a `.xsession' and `.twmrc' file for that account with
a menu system, or some program launcher like bricons, which only provides
a menu of programs that that user is allowed to use. If you do not provide
access to a xterm runing a shell or a editor, the user can not run
anything you do not provide via menu.

Text base programs can be provided by runing them in a xterm directly IE:

     xterm -g 80x40 -T Eliza -n Eliza -e eliza &

You do not even have to provide a valid shell in the passwd file, which
prevents non-xwindow access, and causes normal xterm logins to fail
anyway.

We use this here and Griffith Univeristy to Setup a guest account for 
the public on the University's Openday.


  Anthony Thyssen - (SysProg @ Griffith University)     anthony@cit.gu.edu.au
------------------------------------------------------------------------------
  ``Simplicity has a habit of expanding into catastrophe''
                                  --- "The Ship who Sang" -- Anne McCaffrey
------------------------------------------------------------------------------
Newsgroups: comp.unix.shell
From: marc@cmptrc.lonestar.org (Marc Elewitz)
Subject: ksh: expression eval feature or bug?
Date: Wed, 6 Jan 1993 22:44:49 GMT
Organization: CompuTrac Inc., Richardson TX

I finally figured out a way to get inline arithmetic expressions
to evaluate properly, anywhere in a command line.  Unfortunately,
I got their by trial and error, and don't understand how it works!

Can someone help me understand the following command sequence?

$set -x

	Turn on ksh tracing to show what ksh is thinking about.

$date
+ date
Wed Jan  6 12:02:43 CST 1993
$print $(date)
+ date
+ print Wed Jan  6 12:02:50 CST 1993
Wed Jan  6 12:02:50 CST 1993

  The date command sends the date string to stdout.  The construct
	$( ... ) is defined to execute ... as a command, where everything
	written to stdout is returned as the value.  See example above, the
	output of the date command is returned, and printed.

$((1+2))
+ let 1+2

	Double open parens is defined to be equivalent to the ksh let builtin
	which evaluates its parms as an expression.  Nothing is, or should be,
	written to stdout.

$print $(((1+2)))
+ print 3
3

	Although '((1+2))' sends nothing to stdout, 'print $(((1+2)))' displays
	the expression result.  Why??

  And further,

$(1+2)
+ 1+2
ksh: 1+2:  not found

	Single parens execute enclosing commands in a subshell environment.
	This attempts to execute '1+2' in a subshell, shouldn't and doesn't
	evaluate the expression, and unable to find a program of that name
	generates an error to stderr; but, sends nothing to stdout.  Nothing
	interesting.

$print $((1+2))
+ print 3
3

	Somehow again, while nothing should be sent by the command '(1+2)'
	to stdout, the expression result is printed.

While I like the functionality of expression evaluation inline, I don't
understand how it's happening, whether it's designed in or a bug?  Should
I stay away from it in scripts??

This additional example seems to clearly be a bug:

$x="$(((1+2)))"
+ x=3
$print \"$x\"
+ print "3"
"3"

	The assignment sets x to the expression result.  The '\"' is used to
	surround the value of x with double quotes.

$x="$( ((1+2)) )"
+ + let 1+2
x= let 1+2
og$                 (This line actually displays)
$print \"$x\"
+ print " let 1+2 og$"
" let 1+2 og$"

	In this case, a let statement and some junk was assigned into x.
	Sometimes it's just the let.  I've frequently seen a portion of my
	prompt or .profile.  It doesn't seem right to me that the text of
	a statement should be assigned, ever - it should evaluate to the null
	string.  bug. bug. bug.


Thanks for any assistance.

============================================================================
Marc Elewitz              CompuTrac, Inc.                 
                          222 Municipal Drive             214/235-7176 x3300 
marc@cmptrc.lonestar.org  Richardson, TX 75080            214/234-6280 (FAX) 
============================================================================
From: henk@rigel.cs.pdx.edu (David C. Henkemeyer)
Newsgroups: comp.unix.shell
Subject: BASH info wanted
Summary: I need some BASH info
Keywords: BASH
Date: 9 Jan 93 02:24:07 GMT
Article-I.D.: pdxgate.6681

I recently converted from csh to BASH, and I was looking for some good sources
of information (besides the man page, which I have) for getting me going in my
ne shell...  I'd appreciate any suggestions, or an FAQ file if one exists...

	Thanks,
	David C. Henkemeyer
	a0dh@odin.cc.pdx.edu


---------------------------------------------------------------------.
|   David C. Henkemeyer -*- ACS Consultant -*- henk@rigel.cs.pdx.edu  |
|          \\\\\\\\\\  Portland State University  //////////          |
`---------------------------------------------------------------------'
Newsgroups: comp.unix.shell
From: yorton@turtle11.rtsg.mot.com (James J. Yorton)
Subject: Re: File completion in Ksh.
Reply-To: yorton@rtsg.mot.com
Organization: Motorola Inc., Cellular Infrastructure Group
Date: Mon, 4 Jan 1993 14:57:37 GMT

In comp.unix.shell ram@court.mentorg.com (Ram Tumuluri) writes:
|> Is there an equivalent of "set filec" (csh) mechanism in ksh. If not is there
|> any easy mechanism to get file completion in ksh.


Yes.  If you're using vi-style command line editing,
press <ESC>* (i.e., the ESCape key followed by the asterisk).
Another type of file name completion is <ESC>\ (i.e., the
ESCape key followed by the backslash) and expands on exact
matches only.  This is similar to tcsh's file name completion.
If you're using emacs-style command line editing, press
<ESC><ESC> (i.e., type ESCape key twice).

--------------------------------------+---------------------------------------
Jim Yorton                            | Telephone:  +1 708-632-6695
Motorola Inc., General Systems Sector |
Cellular Infrastructure Group         | Internet:  yorton@rtsg.mot.com
Arlington Heights, IL  60004          | X.400:     qa1010@email
Newsgroups: comp.unix.shell
From: hoogs@alc.com (Tim Hoogasian, Senior Network Admin)
Subject: Re: Allowing only user a,b, and c to read my di
Reply-To: hoogs@alc.com
Organization: Ascent Logic Corporation, Inc.
Date: Tue, 5 Jan 1993 21:13:26 GMT

something along the lines of this "should" do about what you want:

in /etc/group:

..
group1:*:101: me,user1,user2
group2:*:102: me,user2,user3
..

in ~me:

$ ls -lg ~me/bin

..
drwxr-x---  2 me       group1        512 Jan  4 15:12 mystuff/
drwxr-x---  2 me       group2        512 Jan  4 15:12 neat_stuff/
..

---
==========================================================================
#define DISCLAIMER "I don't even represent myself, much less anyone else!"
Internet: hoogs@alc.com | UUCP: ...!netcom!alc!hoogs | Tel: (408) 943-0630
==========================================================================

Newsgroups: comp.unix.shell
From: wvarga@gmuvax2.gmu.edu (Wilson Varga)
Subject: Re: How to make Restrict Shell more safely?
Summary: try a commercial product for the purpose
Organization: George Mason University, Fairfax, Va.
Date: Wed, 6 Jan 1993 13:56:39 GMT

In article <1993Jan4.200732.7262@news.acns.nwu.edu> navarra@casbah.acns.nwu.edu (John Navarra) writes:
>In article <1993Jan4.194925.7364@crd.ge.com> davidsen@crd.ge.com (bill davidsen) writes:
>>  4. Remember that some programs give shell access via escapes, like vi,
>>emacs, etc. Some versions use PATH and are safe, some use /bin/sh and
>>are not at all safe.
>
>Yeah, here is the BIG problem. If you want to let restricted users have 
>access to vi, mail, and news, you have the shell escape problem. This
>is not a trivial thing to fix -- especially if you don't have the source.
>
>>  5. The *really* safe way to have guest users is to run them in a tiny
>>system of their own using chroot. It is very hard to do this without
>>losing a lot of functionality, however, so I don't do that.

There is a commercial product, CENTRUS UX, that solves all of this by
keeping end-users within a menu system.  What the resrticted class of
end-users is permitted to do/not do is entirely under the control of
the system administrator.  Access to any of the unix shells is also
effectively eliminated, without restricting the functionality of
applications such as vi.  Contact the company directly for more
information.  I know that CENTRUS is currently available for HP-UX, but
the company is seeking to compile for other versions of unix.
Contact uss@uii.com.
Newsgroups: comp.unix.shell
From: jprekopa@admiral.uucp (Jeff Prekopa)
Subject: HELP!! Having problems with NEWGRP in Xenix (Bourne) shell
Reply-To: jprekopa@admiral.uucp (Jeff Prekopa)
Organization: The Grid/Waffle BBS, 203-661-2873, -1279, -0450, -2967
Date: Thu, 7 Jan 1993 15:09:34 GMT

I'm trying to set up a "postmaster" type arrangement for reading 
email-boxes on my system. My approach was to set the postmaster handled 
mailboxes to group postmstr, with rw-rw--w- permissions so group members 
can access the box.

The problem is that I don't want the user's primary group to be postmstr, 
and I wanted to use newgrp in a shell to change the user's group to 
postmstr, read the mailbox, then change back to the users primary group.

something like ...        newgrp postmstr
                          elm -f /usr/spool/mail/mailbox
                          newgrp

newgrp executes as  "exec newgrp", and terminates my shell script after 
changing group, before the "elm -f" line. Is there a way to pass the next 
command to execute on the newgrp line? Is there another way to invoke 
newgrp so it doesn't run as an exec newgrp?

For that matter, can anyone suggest a better way to give two or more 
users access to the same mailbox, without making the box public?

Please respond via email. Thanks in advance!

--
jprekopa%admiral.uucp@yale.edu (Jeff Prekopa) <yale!admiral!jprekopa>
The Admiral's Public UNIX - Greenwich, CT - System Administrator: Doug Fields
(HST/V32) (203)661-2873 -- (PEP/V32) -1279 -- (V32) -0450 -- (V29/MNP6) -2967
>FREE!< Unix shell accounts, Usenet access, and Internet-style mail available
Newsgroups: comp.unix.shell
From: fan1321@cs.cuhk.hk (George Fan )
Subject: Re: File Problem.
Organization: Faculty of Engineering, The Chinese U. of Hong Kong
Distribution: comp
Date: Sun, 10 Jan 1993 17:41:52 GMT

wrasman@duncan.utkcs (Mirror Mirror on the wall) writes:

>I seem to have accidently created a file that starts out with
>a - . I can't get rm to get rid of it and I can mv to another file
>name. SO does anyone know how to get rid of a file like this.

 May be You can try  rm ./-xxxx  (i.e  include the path ).
 Indeed, it's a FAQ . :)

>--
>  @             Internet:wrasman@cs.utk.edu, as766@cleveland.freenet.edu 
> (!=>---        Bitnet:Razron@utkvx                                      
> / ) Raz        Usnail: 2305 Laurel Ave #2 Knoxville,TN 37916       

George.
From: davidsen@ariel.crd.GE.COM (william E Davidsen)
Newsgroups: comp.unix.shell
Subject: Re: SYS V lp interface script
Date: 7 Jan 93 17:11:13 GMT
Reply-To: davidsen@crd.ge.com (bill davidsen)
Organization: GE Corporate R&D Center, Schenectady NY

In article <1ielouINN6fd@msuinfo.cl.msu.edu>, mireley@arnou.cem.msu.edu.brewery (John D. Mireley) writes:
| 
| I am trying to modify a lp interface script on an AT&T
| 3B2-400 (SYS V r 3.1) to copy (rcp) a file to a SPARC and 
| print it using lpr. The rcp works fine put the remsh
| from the 3B2 will not execute the lpr request on the Sun.
| In fact, I don't think it will execute anything. The script
| works when I "su" to lp and run it but fails when run through
| lpsched.

  I usually just run a remsh (or rcmd on some systems) of "lpr -" rather
than copy the file. Seems to work just fine, although I wish the real
interface worked.

  Actually you have to build the options and stuff and do
	lpr $OPTIONS -
to make it work right, but you knew that.
-- 
bill davidsen, GE Corp. R&D Center; Box 8; Schenectady NY 12345
    Keyboard controller has been disabled, press F1 to continue.
Newsgroups: comp.unix.shell,comp.unix.programmer
From: jar@solva.ifi.uio.no (Jo Are Rosland)
Subject: Re: A quoting problem.
X-Md4-Signature: 7865957a18c847f93c565a20a7cbbbed
Organization: Dept. of Informatics, University of Oslo, Norway
	<lkjmdgINN3t2@exodus.Eng.Sun.COM>
Date: Tue, 5 Jan 1993 22:41:21 GMT
Originator: jar@solva.ifi.uio.no

In article <lkjmdgINN3t2@exodus.Eng.Sun.COM> Rich Burridge writes:
> Let's turn this into a more specific example. Solving this will hopefully
> show me how to solve the generic case.
> ------
> 
> I have three files I want to set the environment variable FILES too:
> 
> file a
> file'a
> file"a
> 
> What should the string cmd be equal too below in order to get this to work?
> 
> char cmd[1024] ;
> 
> /*  Incorrect version - no quoting. */
> 
> strcpy(cmd, "FILES='file a file'a file"a';export FILES;rm $FILES") ;
> 
> ...
> 
> execl("/bin/sh", "sh", "-c", cmd, (char *) 0) ;
> 
> -----
> No solutions suggest unlink and removing the files one at a time please.
> I need a generic solution. I need the correct quoted interpretation of:
> 
> FILES='file a file'a file"a'
> 
> that correctly works in the string above. Note that people have suggested
> using putenv(3). I'd still have the same quoting problem there.
> 
> Thanks again for any help.

Quoting is not all you have to do to achieve the above, the following
works:

  strcpy(cmd, "FILES='file\\ a file'\\\\\\''a file\\\"a'; eval touch $FILES");

The shell doesn't do any further quote processing on the value of an
environment variable, so you have to use eval to get that done.

This is how you'd program if you know the value to pass on to execl()
already at compile time.  But this doesn't seem to fit with what
you're saying about a "generic routine".  I guess your function is
getting these file names, and the command to run, as arguments, and
that the command argument can include the use of the environment
variable FILES, and possibly some other variables as well.

In this case your code could look like this:

  char cmd[8192];
  char files[8192];

  for each file name {
      for each character {
          if (character == single-quote)
              add '\\\'' to files (as a literal string in c
              this would be "'\\\\\\''")
          else
              add a backquote followed by the character to files
      }
      add a space to files
  }

  sprintf(cmd, "FILES=\'%s\'; eval %s", files, command);

  execl("/bin/sh", "sh", "-c", cmd, (char *) 0) ;


Hope this helps,
--
Jo Are Rosland
jar@ifi.uio.no
From: d3a061@aggie.oname (ZT Taylor)
Newsgroups: comp.unix.shell
Subject: Bourne shell functions; what of 'exit'?
Date: 11 Jan 93 16:54:25 GMT
Article-I.D.: oracle.1993Jan11.165425.7692
Reply-To: zt_taylor@pnl.gov
Organization: Pacific Northwest Laboratory

Bourne shell functions seem to be inconsistent in the way they handle an 'exit'
statement.  For example, the following:

	func() {
		.
		.
		exit 1
	}

	func

causes the whole shell script to exit, while this:

	func() {
		.
		.
		exit 1
	}

	junk=`func`
	echo $?

doesn't.  At first I thought this meant func was executed in a subshell, but
echoing $$ both places gives the same PID.  Is this context-sensitive treatment
of 'exit' a feature?  Can it be counted on in portable scripts?

Unless flamed for the stupidity of my question, I will summarize.

Todd Taylor
Pacific Northwest Laboratory
zt_taylor@pnl.gov
Newsgroups: comp.unix.shell