HDTenEightyP/NetNews huggingface dataset:
From: stecz@pencom.com (John Steczkowski)
Newsgroups: comp.unix.shell
Subject: Re: Help using find with wildcards
Date: 31 Dec 92 14:22:49 GMT
Reply-To: stecz@pencom.com
Distribution: austin
Organization: Pencom Software

In article <1992Dec31.043445.2794@mnemosyne.cs.du.edu> jefouger@nyx.cs.du.edu  
(Jim  Fougeron) writes:
> markn@ssd.comm.mot.com (Mark Nowak) writes:
> 
> >Anybody know how to find files, directories, etc. when you
> >don't know the exact name of the file you're looking for.
> >For example, I'm looking for file abcde in some directory
> >tree, but the only characters I know for sure are bcd.  Is
> >there a wat to use find to locate this file?
> 
> >I'm thinking of something along the lines of:
> 
> >find . -name *bcd* -print
> 
> try:    find . -name \*bcd\* -print
> 
> >but that doesn't work.

also try: find . -name "*bcd*" -print

That is how I normally do it, and it works on many different UNIXes.

--
--
  John Steczkowski                        stecz@pencom.com
  "Achilles raised his spear, took careful aim, and hurled."
  					    from the Iliad
Newsgroups: comp.unix.shell
From: pbm@fc.hp.com (Peter McLain)
Subject: Re: timing piped commands
Date: Mon, 21 Dec 1992 15:54:32 GMT
Organization: Hewlett-Packard Fort Collins Site
X-Newsreader: TIN [version 1.1.3 PL6]

Xiaobing Chen (xiaobing@cs.sfu.ca) wrote:
: Anybody tell me how to 'time' piped commands like:
: 	% time 'ls -lR | fgrep root'	# failed of course
: 
    You didn't mention which shell you are using, but from the prompt, I 
    assume csh.  My man page for csh says that time only works on simple
    commands, so you may be out of luck with csh (but I never use csh, so
    could be wrong).

    If you have ksh, then the following will work:

	$ time { ls -lR | fgrep root ;}

Peter McLain
pbm@fc.hp.com

Newsgroups: comp.unix.shell
From: kasajian@netcom.com (Kenneth Kasajian)
Subject: pwd
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Thu, 31 Dec 1992 02:27:25 GMT

Hello.  I'm using tcsh as my shell.  I was wondering..  how do I get
the prompt to show my local directory like in dos PROMPT $P$G
I've tried:
prompt `pwd`
but the prompt is set to the directory name at the time of the setting
and doesn't change when change directories.  How do I get it to
execute everytime.  can I overwrite 'cd' ?
From: mike@pacsoft.com (Mike Stefanik)
Newsgroups: comp.unix.shell
Subject: Re: need a bit of help in
Date: 2 Jan 93 10:52:39 GMT
Organization: Pacific Software Group, Riverside, CA

In an article, rduta@nyx.cs.du.edu (Radu) writes:
>1) I want a method of copying whole directories.  I'm used to the mac where
>you can just drag folders form one dir to another and it moves it or
>copies it.  I want something similar for unix.  The thing is that I
>Haven't the slightest idea how to start.

If you want to copy a directory (as well as all of the subdirectories
underneath it) you can use the find(1) and cpio(1) commands:

    ( cd /some/directory; find . -print ) | cpio -pdum /somewhere/new

If you want to rename or move directories around, try mv(1) or mvdir(1)

>2) I was wandering what is the easiest way to do a recursive grep, where
>it searches all the files in all dirs.  I was thinking something along
>the lines of "grep -R string *" but the "-R" flag is not an option.

Again, use the find(1) command in conjunction with xargs(1) and grep(1),
such as:

	find . -type f -print | xargs -e grep "foo"

The "-type f" option tells find(1) to only return regular files (not
directories, character or block special device files, etc.) and xargs(1)
collects the filenames through the pipe and gives them to grep(1).

-- 
Mike Stefanik  mike@pacsoft.com  ...!uunet!pacsoft!mike  (909) 681-2623
Pacific Software Group, Riverside, CA
From: hartman@informix.com (Robert Hartman)
Newsgroups: comp.unix.shell
Subject: Re: Novice Unix user help
Date: 17 Dec 92 03:07:49 GMT
Organization: Informix Software, Inc.

In article <1992Dec14.214005.15179@brtph560.bnr.ca> esh@bnr.ca (Jim Eshelman P910) writes:
>In article <101787@netnews.upenn.edu>, ericj@eniac.seas.upenn.edu (Eric J Reiter) writes:
>|> Can anyone tell me how I can change my prompt to display what directory I am 
>|> in; i.e. like DOS set prompt=$p$g ?
>|> 
>If you are in CSH, you can try:
>
>    alias  cd       'cd \!*; set prompt = "{`pwd`}<\! >"'

Maybe it's just me, but I find that prompt business to be quite
annoying.  I also find that I can remember what directory I'm in as
long as I stay there.  It's only when I move that I need to know.
So I just alias cd like this:

	alias cd 'cd \!*; echo $cwd'

I also define "." as an alias for 'echo $cwd', so that when I do
happen to forget, I can get a reminder in 2 keystrokes. 

(When I'm in ksh, I use "," instead.)

>but note that most of the gurus out there will likely ignore your question
>since this kind of info is in the Frequently Asked Questions (FAQ) files
>which were posted just last week.  Get a copy & study before venturing here
>as a novice -- and provide more detail on the system you are using.

Yup.  One thing to remember about UNIX, although you can usually
make it do what you want, sometimes it's less trouble to find an
alternative method that will accomplish the same thing.

-r
Newsgroups: comp.unix.shell
From: ta2321s@dunix.drake.edu (Terry Asher alias -       The Penguin)
Subject: How to automount an NFS?
Organization: Drake University, Des Moines, Iowa, USA
Distribution: na
Date: Tue, 22 Dec 1992 22:11:15 GMT

   I am trying to automount wuarchive.wustl.edu on /stl.  When I give the
command automount -f auto -M /stl and then cd to /stl and say ls I get nothing.
My auto file in /etc looks like this:
/stl           -ro             wuarchive.wustl.edu:/archive/graphics/gif
I have also tried the command:
automount -M /stl and still no go.
   I want to automount rather than mount because if wuarchive goes down then
it adversely affects my Unix system.  Thanks for any help.
Newsgroups: comp.unix.shell
From: hellmann@cs.scarolina.edu (Doug Hellmann)
Subject: Re: Opening up remote xterm windows?
Organization: USC  Department of Computer Science
Date: 24 Dec 92 16:51:18 GMT

leisner@wrc.xerox.com ( Marty Leisner) writes:

>I want a good way to open up remote xterm windows...

>I'm using bash and have this a function:
>rxterm () 
>{ 
>    rsh $1 ./dologin "xterm -title $1 -display `hostname`:0 -e bash "  &
>}

>The problem is, I get:

>rxterm annapurna
>[1] 5444
>leisner@hydrus$ 
>[1]+  Stopped (tty input)     rsh $1 ./dologin "xterm -title $1 -display `hostname`:0 -e bash "


>I tried redirecting stdout/stderr to /dev/null, but no luck...

>The rsh is a job, which I can kill after it executes...

>What I want is a system which backgrounds, and lets the rsh terminate cleanly...

>Or is there a better way of doing what I'm trying to do?

I do something like this, but not exactly what I think you are trying to do.
Using tcsh, I start an xterm on my machine, and execute a telnet to the
machine I want to have the session logged in on.

I have some specific machines that I want to do this with, so I don't bother
with making it generic.  I set up some buttons on my root window menu to let
me create a new window with two clicks of the mouse button.

The important command line options here are :

	-e	to execute a shell statement
	-ls	to make this a login shell (runs your .login for you)
	-title	so you know what the window holds

Here are some sample lines, with some other neat stuff thrown in:

To Read Mail:

( /usr/bin/X11/xterm -title ELM -xrm iconTitle=ELM -e /usr/local/bin/elm -m &)

For a New Window on current machine:

(/usr/bin/X11/xterm -ls -cb -title `hostname` &)

To ftp to a site:

(/usr/bin/X11/xterm -cb -title gatekeeper -e ftp gatekeeper.dec.com &)

To rlogin (or telnet) to another site: (note that it also allows you to

start up other X clients on the foriegn machine and display on your machine)

(/usr/bin/X11/xhost +; /usr/bin/X11/xterm -cb -title gondwana -e rlogin gondwana.geol.scarolina.edu&)

>--
>marty
>leisner.henr801c@xerox.com  leisner@eso.mc.xerox.com
>Member of the League for Programming Freedom


--------------------------------------------------------------------------------
Doug Hellmann                         No one is exempt from talking nonsense,
University of South Carolina          the only misfortune is to do it solemnly.
hellmann@cs.scarolina.edu               -- Montaigne
Newsgroups: comp.unix.shell
From: dattier@ddsw1.mcs.com (DWT)
Subject: Re: ksh autoload quirk
Date: Mon, 21 Dec 1992 20:37:26 GMT
Organization: Contributor Account at ddsw1, Chicago, Illinois  60657

lvirden@cas.org (Larry W. Virden) wrote in <1992Dec20.112016.14120@cas.org>:

| Here is what our ATT Toolchest man page says about FPATH:
| 
|           FPATH
|                The search  path  for  function  definitions.   By
|                default  the  FPATH directories are searched after
|                the PATH  variable.   If  an  executable  file  is
|                found, then it is read and executed in the current
|                environment.  FPATH is searched before PATH when a
|                function with the -u attribute is referenced.  The
|                preset alias autoload preset alias (sic) causes a  func-
|                tion with the -u attribute to be created.

And that's exactly what I encountered, so even if the behavior wasn't
intentional I'm not the first to discover it.

Unfortunately, the man page here [ddsw1 runs Dell SVR4 v4, but I don't see
Dell's name in the man page] says this:

| FPATH The search path for function definitions.  This path is
|       searched when a function with the -u attribute is referenced
|       and when a command is not found.  If an executable file is
|       found, then it is read and executed in the current
|       environment.

Note the ambiguous language.  "A when B and when C"; does that mean "A when
B and also A when C" [i.e., A when (B or C)] or does it mean "A when both
(B and C)"?  I'd have taken it to mean the latter.  Obviously the former
interpretation is borne out this time, and there is nothing to indicate that
the difference in search order.

Also, files in $FPATH for autoload don't have to be executable; read
permission is enough.  The AT&T man page also says that execute permission
is needed, but maybe in that ksh it is.

David W. Tamkin   Box 59297   Northtown Station, Illinois  60659-0297
dattier@ddsw1.mcs.com    CompuServe: 73720,1570    MCI Mail: 426-1818
Newsgroups: comp.unix.shell
From: s1110238@giaeb.cc.monash.edu.au (Lee Hollingworth)
Subject: Re: pwd
Organization: Monash University, Melb., Australia.
Date: Thu, 31 Dec 1992 09:14:41 GMT

kasajian@netcom.com (Kenneth Kasajian) writes:

>Hello.  I'm using tcsh as my shell.  I was wondering..  how do I get
>the prompt to show my local directory like in dos PROMPT $P$G
>I've tried:
>prompt `pwd`
>but the prompt is set to the directory name at the time of the setting
>and doesn't change when change directories.  How do I get it to
>execute everytime.  can I overwrite 'cd' ?

Try adding an alias or two to your .cshrc file.

# Set up sensible prompt and a few alii
alias cd 'cd \!* ; set prompt = "$cwd> "'
alias pop 'popd \!* ; set prompt = "$cwd> "'
alias pushd 'pushd \!* ; set prompt = "$cwd> "'
cd .

Lee Hollingworth
s1110238@giaeb.cc.monash.edu.au
Newsgroups: comp.unix.shell
From: s1110238@giaeb.cc.monash.edu.au (Lee Hollingworth)
Subject: Re: need a bit of help in
Organization: Monash University, Melb., Australia.
Date: Sat, 2 Jan 1993 06:42:52 GMT

rduta@nyx.cs.du.edu (Radu) writes:


>Ok, tow things:
>1) I want a method of copying whole directories.  I'm used to the mac where
>   you can just drag folders form one dir to another and it moves it or
>   copies it.  I want something similar for unix.  The thing is that I
>   Haven't the slightest idea how to start.

>2) I was wandering what is the easiest way to do a recursive grep, where
>   it searches all the files in all dirs.  I was thinking something along
>   the lines of "grep -R string *" but the "-R" flag is not an option.

>any ideas?

Check out the "man" entry for cp, eg the recusive argument -r ...

Lee Hollingworth
s1110238@giaeb.cc.monash.edu.au
From: busby@phoenix.ocf.llnl.gov (lee e busby)
Newsgroups: comp.unix.shell
Subject: Last background PID in CSH?
Summary: Anybody know a good way to get the PID of the last background process?
Date: 23 Dec 92 22:12:17 GMT
Organization: Lawrence Livermore National Laboratory

Seems like it should be easy, but I can't figure out a good way to
do it.  Inside of a CSH script, I start up a command and put it in
the background.  Later on, I want to come back and kill the
backgrounded process.  How to refer to it?  (It's easy with the
Bourne shell, of course.)

Right now, the best I have come up with is to start the process,
then run "jobs -l" and parse the output with awk to get the PID.
Surely there's a smarter way....
Newsgroups: comp.unix.shell
From: dfox@quack.sac.ca.us (David Fox)
Subject: Re: stripping cr/lf's
Organization: The Duck Pond public unix: +1 408 249 9630, log in as 'guest'.
Date: 3 Jan 1993 23:00:32 UTC

In article <1992Dec31.071312.6153@netcom.com> kasajian@netcom.com (Kenneth Kasajian) writes:
>
>How do I strip the cr's from a text file?  There must be a standard
>unix way of doing it!

There is.  One typically needs to do this when migrating DOS text files (where
each line ends in a CR and NL (ascii 13/10) to Unix (where each line ends with
just NL (ascii 10)).

Use the tr command.

% tr -d '\015' <in.txt >out.txt

The '\015' may look strange: tr - and other unix commands - think in OCTAL.
Octal 015 = 12 decimal.
--
David Fox
dfox@quack.sac.ca.us

 


Newsgroups: comp.unix.shell
From: dman@netcom.com (Dallman Ross)
Subject: Re: wanted: tutorial about sh programming
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
X-Newsreader: TIN [version 1.1 PL8]
Date: Tue, 29 Dec 1992 09:32:00 GMT

In article <1992Dec23.191853.24899@nosc.mil>, mcdono@nosc.mil (Tim McDonough CSC Room 191 Phone 553 3102 ) writes:

: I'd like the following line to produce the output below it.
: 
: |> Hostname is foo     Host id is 78454
: |> Hostname is fooobar Host id is 89000

Simple solution in sh:

$ echo "hostname is `hostname`; hostid is `hostid`"
hostname is netcom2; hostid is 72605053

--
 __D_a l_l m a_n  _ R o_s s _ |dman@netcom.com  /or/  |"You sound like a man|
 l  \\ l\\   /l  /\\  l\\   l |dross@well.sf.ca.us    |with a rubber nose." |
 l   >)l \\ /ll /  \\ l \\  l |vox/fax: 1.510.645.1883| -- One-Lung Bill    |
 l  // l  \X ll/--- \\l  \\ l |350 Perkins St., #108  |     Remmer (deceased)
_l//______________________\\l_|Oakland,_CA__94610-3422|_____________________|_
Newsgroups: comp.unix.shell
From: rdavis@convex.com (Ray Davis)
Subject: Re: How to do csh-like alias in ksh?
Organization: CONVEX Computer Corporation, Richardson, Tx., USA
Distribution: pnw
Date: Mon, 28 Dec 1992 18:06:00 GMT
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

russsan@microsoft.com (Russell Sanchez) writes:

>Is there any way to do a csh-like 'bang' in ksh aliases?  I'm basically
>trying to do alias substitution (including parser metasyntax if possible).
>For example, I want to convert the csh alias...
>alias ff 'find . -name /!* -print'
>...to ksh, something like...
>alias ff='find . -name ???? -print'
>...but what is the ????.  ksh doesn't seem to parse commands like csh.

Not possible with aliases, but with functions:

	function ff { find . -name $* -print; }
or:	ff() { find . -name $* -print; }

if you prefer.

Ray
Newsgroups: comp.unix.shell
From: jefouger@nyx.cs.du.edu (Jim  Fougeron)
Subject: Re: stripping cr/lf's
Organization: University of Denver, Dept. of Math & Comp. Sci.
Date: Thu, 31 Dec 92 16:54:09 GMT

kasajian@netcom.com (Kenneth Kasajian) writes:


>How do I strip the cr's from a text file?  There must be a standard
>unix way of doing it!
>thanks

I perform this task with a utility from Omen (rz/sz people) called undos.
This program will convert files from dos-unix-mac-cpm.
If you wanted to do this ONLY using standard Unix commands, one way is:
tr -d '/15' < infile > outfile
NOTE: Do not do this on anything other than PLAIN text, or you will end up
      with  a corrupted output file.
Hope this helps.
--
---------------------------------------------------------------------------
|  Jim Fougeron                |  What is the true meaning of happiness?  |
|  jefouger@nyx.cs.du.edu      |   Is it money, cars and women, ... or    |
|  jimfn@ids.net               |   just money and cars?  Calvin & Hobbes  |
Newsgroups: comp.unix.shell
From: merlin@mits.mdata.fi (Markku M{kel{)
Subject: Re: pwd
Organization: Microdata Oy
Date: Thu, 31 Dec 1992 18:29:55 GMT

kasajian@netcom.com (Kenneth Kasajian) writes:

>the prompt to show my local directory like in dos PROMPT $P$G

In tcsh you can use:

% set prompt='%~ other stuff'

as a prompt. For example, I use:

% set prompt='[%~] %T %% '

It prints the current directory, time and a %-sign.
Xref: sparky comp.unix.shell:5171 comp.unix.questions:14980
From: dat91uni@ludat.lth.se (Urban Nilsson)
Newsgroups: comp.unix.shell,comp.unix.questions,comp.unix.wizard
Subject: a 'simple' (?) csh question
Date: 27 Dec 92 08:59:12 GMT
Reply-To: dat91uni@ludat.lth.se
Followup-To: comp.unix.shell,dat91uni@ludat.lth.se
Organization: Dept. of Computer Science, University of Lund.


Yo !

I have this small problem with a shell program I've done
I create this bunch of files in /tmp and afterward when it's
time to get them together i miss some files ! why, I cant find
any reason to it, if I dont delete them every file that I need
is there, why dont I get all the files in the resultfile ???

cheers / UNI :-(


---
#! /bin/csh 

#  known bugs/limitations:
#     if a user is logged in over midnight the program can
#      give a wrong result.
#     solution: get a real life!
#

set temp1 = /tmp/ww1$$
set temp2 = /tmp/ww2$$

switch($#argv)
   case 1:
      foreach name (bach satie)
         foreach num (1 2 3 4 5 6 7 8 9 10)
            (echo `rsh $name-$num last $argv[1] | head -1 | cut -c41-` $name-$num &)>! $temp1$name$num
         end
      end
      foreach num (11 12 13 14 15 16)
            (echo `rsh $name-$num last $argv[1] | head -1 | cut -c41-` $name-$num &) >! $temp1$name$num
      end
      wait
      cat $temp1* >! $temp2
      sleep 3
      set stilltst = `grep "still" $temp2`
      if ("$stilltst" == "") then
         set slask = `sort +0rM +1nr +2nr $temp2 | head -1`
         if ("$slask" == "") exit 1
         echo $argv[1] was last on : $slask
      else
         echo -n "$argv[1] is still on at "
         echo `echo $stilltst | cut -c30-`
      endif
      unalias rm
      rm -f $temp1* >& /dev/null
      rm -f $temp2* >& /dev/null
   breaksw
   default:
      echo "usage: ww <username>"
      exit 1
endsw

exit 0
---

Thanks in advance, I'd prefere respons with e-mail.


---
Lev Gott ...    , Have a nice life ...

Urban Nilsson  (UNI)                  | Snailmail: Magistergatan 2
Internet:      dat91uni@ludat.lth.se  |            252 27 Helsingborg
Phone, voice:  +46 42 182154          |            Sweden
                                      |
IgorMud:       Cedric                 |
---
Newsgroups: comp.unix.shell
From: rduta@nyx.cs.du.edu (Radu)
Subject: Re: need a bit of help in
Organization: Nyx, Public Access Unix @ U. of Denver Math/CS dept.
Date: Sat, 2 Jan 93 09:28:31 GMT

Ok, yea i missed the flags for cp, thanks for pointing that out, it saved me
a lot of time.

Is there a way to pipe text into something like telnet or ftp.  Nothing that i
tried works.  At first I thought that I could pipe an echo, but it didn't work.
Anyone know how to do it, or if it's possible?
--
********************************************************************************
I only kill to know I'm alive!
Newsgroups: comp.unix.shell
From: gandigli@torino.maraut.it (Flavio Gandiglio)
Newsgroups: comp.unix.shell
Subject: Re: pwd
Keywords: pwd tcsh prompt
Date: 31 Dec 92 08:01:32 GMT
Organization: Magneti Marelli, Electronics Division (ITALY)
NNTP-Posting-Host: nocciola.torino.maraut.it

the command
set prompt="%B%m%b %T:%c2 %h %# "
sets the prompt to 

hostname time:current directory command number >

Es:
nocciola 9:00:~ 26 > 
Bye

=============================================================================

    Flavio Gandiglio			
    Magneti Marelli
    Divisione Elettronica		Tel:    +39 - 11 - 2411.1 (int. 315)
    C.so Giulio Cesare, 328		Fax:	+39 - 11 - 2411.316
    I-10154 Torino (ITALY)		Email: 	FGandiglio@torino.maraut.it

=============================================================================
From: eric@nit.pactel.com (Eric Pederson)
Newsgroups: comp.unix.shell
Subject: Re: too many values in environment
Date: 22 Dec 92 22:12:55 GMT
Organization: Pac*Tel Corporation

I write:

>I am running SunOS 4.1.x and C-shell.  According to TFM, the maximum
>amount of space that argv[] and envp[] may take up is returned
>by sysconf(2).  On my machine the value is 1 megabyte.  However, my
>shell doesn't want to accept more than 100 environment variables.
>Since I am running some applications that require a zillion variables
>to be set before I run them, this limitation is a pain.

>The putenv(3) library function allocates more enviromnent space using
>malloc() if neccessary.  Shouldn't csh's "setenv" built-in do the same
>thing?

I figured out (finally) that the program /bin/env is the one
giving the message "too many values in environment".  I can indeed
put much more than 100 values in my environment, but I must
use the builtin "printenv" to display them, not the program "env".

-- 
Eric Pederson                                       Pac*Tel Corporation
eric@nit.pactel.com                                        510-210-8890
Newsgroups: comp.unix.shell
From: ash@ulysses.mr.ams.com (Alan Harder)
Subject: ksh 1, perl 2 - ksh or perl for scripting?
Organization: American Math. Society
Date: Mon, 21 Dec 1992 14:52:37 GMT


Hi, all.  We are currently trying to decide if we should move from
/bin/sh as our language for production scripting to ksh, or if we
should move to perl instead.  Is anyone out there using perl as their
production scripting language of choice? 



-Alan Harder                
 ash@math.ams.org

 My opinions are not the opinions of the American Mathematical Society.
 Did you think they were?
From: dansmith@Autodesk.COM (Daniel Smith)
Newsgroups: comp.unix.shell
Subject: Re: foreach in csh alias (possible?)
Date: 21 Dec 92 19:02:52 GMT
Organization: Autodesk Inc., Sausalito CA, USA

In <BzH1qo.2yt@news.iastate.edu> john@iastate.edu (John Hascall) writes:

> Well, I Read The Fine FAQ, but no mention of this, and I dinked with
> it for the better part of an evening, but no luck.  So, is something like
> this:

>      alias doit 'foreach xx (`list-o-xxs`) \\
>           setenv $xx /foo/$xx \\
>         end'

> possible?

	Yes, it's possible.  This is where simple aliases break down and
sourcing aliases take over :-)

alias   mset 'set xx=(\!*); source ~/bin/multiset_script'

	and ~/bin/multiset_script is:

#!/bin/echo sorry,try:source
foreach i ($xx)
	setenv $i /foo/$i
end

	When you find yourself writing multi-line aliases, stop :-)  They take
longer to debug than bits of sourceable csh...

					Daniel

-- 
     Daniel Smith, Autodesk, Sausalito, California, (415) 332-2344 x 2580
	      Disclaimer: written by a highly caffeinated mammal
	    dansmith@autodesk.com            dansmith@well.sf.ca.us