HDTenEightyP/NetNews huggingface dataset:
From: cwahl@panix.com (Charles Wahl)
Newsgroups: comp.unix.shell
Subject: Re: How can I rm a file with a '&' ????
Date: 6 Sep 92 04:40:26 GMT
Organization: PANIX Public Access Unix, NYC

In <22856@sybase.sybase.com> hsc@sybase.com (Howard Cohen) writes:

>Ok, some facts.  It can be hard to remove files that contain certain 
>characters, becuase of side-effects of their special meanings.  For example,
>try to remove a file that begins with a dash (-).  Surprise! Not so easy.

Actually, it is very easy: just specify the filename as part of a path
which hides the hyphen from ls(1), which tries to interpret the argument
as an optio;, e.g. 'rm ./-deleteme'.  Those who have problems
with this sort of thing are encouraged to revisit the man pages for
whichever shell one uses, and become more familiar with the way that the
input line is parsed.  I believe that there is a pretty good discussion
of manipulating files with funny names is one of the comp.unix FAQs.

Charles Wahl	<cwahl@panix.com>
From: bret@muppet.bt.co.uk (Bret Giddings)
Newsgroups: comp.unix.shell
Subject: Re: awk & echo under bourne
Date: 15 Sep 92 10:32:05 GMT
Reply-To: bret@muppet.bt.co.uk
Organization: British Telecom Research Laboratories


In article FAA@news.larc.nasa.gov, alan@hal.larc.nasa.gov (alan dare) writes:
>
>I have a question on echo'ing and awk under the bourne shell.
>
>First the awk question:
>
>num=`grep NUM_OF_DISPLAYS displays.h| cut -d" " -f3`
>cat display_table.h |awk '$2 == $num {print $0}' >> temp
>
>Can awk access my shell variable?

Using 

awk '$2 == NUM' NUM=$num display_table.h >> temp

should do the trick (although I can't follow what you are trying to achieve :-[ )

>
>The echo'ing question:
>
>junk="start"
>echo "finish_$junk"	# Works
>echo "$junk_finish"	# Doesn't work
>
>How do I get "start_finish" using only one echo  ...

Use

echo "${junk}_finish"


Bret
From: wolf@hp-ptp.ptp.hp.com (Paul Wolf)
Date: Sat, 12 Sep 1992 00:33:38 GMT
Subject: Re: KSH: how to stop $ENV
Organization: HP Pacific Technology Park - Sunnyvale, Ca.
Newsgroups: comp.unix.shell


Scott Pace of Bell Northern Research writes:

 > I have a shell script written in ksh (i.e. has #! /bin/ksh at the start).
 > How do I prevent the ksh from executing $ENV?  This is on HP-UX 7.05.  I
 > have read the man page, and I don't see any switches that would do this.
 > What I really want is the equivalent of the -f switch in the csh.
 > 
 > Thanks.

 How about - 
   $ ENV=  ksh script-file

 which will modify the variable ENV before executing the script in a 
 subshell.

 This is equivalent to - 

   $ (export ENV; ENV=  ksh script-file) 
  
-----
Paul Wolf, wolf@hpams0h.ptp.hp.com
Hewlett Packard, Integrated Systems Division, 1266 Kifer Rd, Sunnyvale, CA
Newsgroups: comp.unix.shell
From: d-lewart@uiuc.edu (Daniel S. Lewart)
Subject: Re: KSH: how to stop $ENV
Originator: lewart@rsm1.physics.uiuc.edu
Reply-To: d-lewart@uiuc.edu (Daniel S. Lewart)
Organization: UIUC Physics Department
Date: Fri, 11 Sep 1992 19:32:10 GMT

In article <1992Sep11.132901.26395@bnr.ca> space%bnr.ca (Scott Pace) writes:

> I have a shell script written in ksh (i.e. has #! /bin/ksh at the start).
> How do I prevent the ksh from executing $ENV?  This is on HP-UX 7.05.  I
> have read the man page, and I don't see any switches that would do this.
> What I really want is the equivalent of the -f switch in the csh.

Try starting with the following:
	#! /bin/ksh -p

Daniel Lewart
d-lewart@uiuc.edu
From: joslin_paul@ae.ge.com
Newsgroups: comp.unix.shell
Subject: Re: Simulating keyboard input in interactive programs
Date: 11 Sep 92 12:57:22 GMT
Reply-To: joslin_paul@ae.ge.com
Distribution: na
Organization: GE Aircraft Engines
Originator: news@c0228.ae.ge.com

>pdel@ADS.COM (Peter Delevoryas) writes:
>: #2
>: 	This is kind of related to #1. Our dial-in lines are set to
>: 	auto-log out after about 20 min. of inactivity. Short of
>: 	programming the terminal-server not to do this, how can I
>: 	keep a process going so that it always seems like I'm doing
>: 	something, even if I'm in the kitchen making a BLT (extra mayo).
>: 	Just starting up some kind of loop won't do it; it has to be
>: 	equal to a keypress from MY keyboard.

Two quick thoughts:

If you're using a pc at home, what about a TSR that puts a "space-CR"
in the keyboard buffer every five minutes?

Second, have you tried something like

while :
do
	sleep 3600
	echo "ls" > `tty`
done

where `tty` returns the tty device your shell is using.
-- 
-- 
     Paul R. Joslin     |Dan Quayle's Top 10 TV complaints:
joslin@c0223.ae.ge.com  | 10. Nobody ever "beams up" William Shatner on
   +1 513 583 3537      |    Rescue 911.
From: morten@oase.kemi.aau.dk (Morten Kjeldgaard)
Newsgroups: comp.unix.shell
Subject: Re: Interactive csh: what is the comment char?
Date: 8 Sep 92 07:46:32 GMT
Organization: Aarhus University, Denmark

In <1992Sep2.233320*Harald.Eikrem@delab.sintef.no> Harald.Eikrem@delab.sintef.no writes:

>! What is the comment character in an interactive csh? When I go
>! 
>! 	% # comment
>! 
>! is says
>! 
>! 	#: Command not found

>Nope, it's not there.  Why?  Do you have an urge for producing interactive
>commants? :)

It sounds stupid, I know. But it would be nice to be able to store a shell
script in the mouse buffer -- with comments and all.

>The : command isn't usable either.  But if you redeclare it as

>   alias :  if 0 0

>then : becomes a do-nothing command.

Hmm. I *really* prefer. '#'. Oh well. Thanks for the info!

/Morten

--
Morten Kjeldgaard  ~ morten@oase.kemi.aau.dk ~ mok@kemi.aau.dk
Biostructural Chemistry, Department of Chemistry, Aarhus University
Langelandsgade 140, DK-8000 Aarhus C, Denmark
Phone: +45 86 12 46 33 ~ +45 86 20 27 11 x6518 ~ Fax: +45 86 19 61 99
From: bill@Celestial.COM (Bill Campbell)
Newsgroups: comp.unix.shell
Subject: Re: KSH: how to stop $ENV
Date: 12 Sep 92 16:59:47 GMT
Organization: Celestial Software, Mercer Island, WA

In <1992Sep11.171131.29549@u.washington.edu> donn@carson.u.washington.edu (Donn Cave) writes:

:space%bnr.ca (Scott Pace) writes:

:| I have a shell script written in ksh (i.e. has #! /bin/ksh at the start).
:| How do I prevent the ksh from executing $ENV?  This is on HP-UX 7.05.  I
:| have read the man page, and I don't see any switches that would do this.
:| What I really want is the equivalent of the -f switch in the csh.

:#!/bin/ksh -p

:But, don't be surprised if it doesn't work!  It works on some Korn shells,
:not others.  It's generally not documented, may be obsolete.  I'd like to
:know - I think it's a valuable feature.  (It's not the same as expecting your
:users to use the bizarre interactive-only formula for ENV.)

:    doesn't work on
:	(DYNIX/ptx 1.3) Version 11/16/88e

:    does work on
:	(DYNIX 3.1) Version 11/16/88d
:	(Ultrix 4.2a) Version 11/16/88
:	(AIX 3.2) Version 11/16/88d SBCS

Add SCO Xenix 2.3.4 and UNIX 3.2v4 to the list it works on.  Of
course the #! /bin/ksh header doesn't work on Xenix, but the -p
option does :-).

Bill
-- 
INTERNET:  bill@Celestial.COM   Bill Campbell; Celestial Software
UUCP:   ...!thebes!camco!bill   6641 East Mercer Way
             uunet!camco!bill   Mercer Island, WA 98040; (206) 947-5591
SPEED COSTS MONEY -- HOW FAST DO YOU WANT TO GO?
From: bfl@duke.cs.duke.edu (Brian Loss)
Newsgroups: comp.unix.shell
Subject: Shell types (May be FAQ)
Date: 8 Sep 92 20:01:20 GMT
Organization: Duke University Computer Science Dept.; Durham, N.C.

In reading this newsgroup, I have seen all sorts of different shells
mentioned (tcsh, zsh, ksh, bash, etc.).  Could someone tell me what the
differences between all these are, and what all of their advantages and
disadvantages are?  Thanks.

Brian Loss
P.S.  If this is a FAQ, then please repost the FAQ list--I have not seen
	it recently.

-- 
Department of Computer Science, Duke University, Durham, NC 27706
Internet:	bfl@cs.duke.edu
UUCP:		mcnc!duke!bfl
Newsgroups: comp.unix.shell
From: guenther@StOlaf.edu (Philip Guenther)
Subject: Re: Help: How to exit from two shells?
Organization: St. Olaf College, Northfield, MN USA
Date: 15 Sep 92 15:09:18


In article <1992Sep15.175330.25203@cs.UAlberta.CA> zhong@cs.UAlberta.CA (John (Zhong)   Li) writes:

   Since some machines cannot support 'tcsh' shell I have to 
   set up my default shell into 'csh'. But I like to use 'tcsh'
   shell. After login, if possible, my '.login' will set 'tcsh'
   automatically. However, since this kind of setting made 
   'tcsh' is not the login shell it is annoying to exit. Every
   time when I logout I have to type "exit", then "logout" or
   "exit". Can anybody tell me a method to jsut type once by
   making either a script or an alias, then I can directly 
   exit from both 'tcsh' and 'csh' shells?

How about having csh exec tcsh instead of just running it?  Then tcsh
would (sorta) be your login shell, and there would be no csh to worry
about. :-)  You may also want to make a symlink to tcsh that starts
with a dash (i.e. "ln -s bin/tcsh bin/-tcsh") and have csh exec that
(i.e. "exec -tcsh").  Then tcsh will think it is a login shell because
argv[0] starts with a dash.  Yes, this is a rather ugly kludge, but it
works...

   thanks in advance!


   --
> -----------------------------------------------------------------------------
> | Li, John              | 492-5094 (office) | I haven't lost my mind,       |
> | zhong@cs.ualberta.ca  | 492-2821 (lab)    | I know exactly where I left it|
> -----------------------------------------------------------------------------

Philip Guenther
--
guenther@stolaf.edu (Philip Guenther)       | The ACC might agree with me,
Student Sys Prog, Academic Computing Center | but with that bunch, (and me)
St Olaf College, Northfield, MN 55057-1001  | you never know... :-) :-| :-(
"Life makes sense?  LIFE MAKES SENSE!!?  Where do people get these ideas?"-me
Newsgroups: comp.unix.shell
From: subbarao@tex.Princeton.EDU (Kartik Subbarao)
Subject: Re: Simulating keyboard input in interactive programs
Reply-To: subbarao@fc.hp.com (Kartik Subbarao)
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
Date: Fri, 11 Sep 1992 14:22:02 GMT

In article <joslin.716216242@c0223.ae.ge.com> joslin_paul@ae.ge.com writes:
>>pdel@ADS.COM (Peter Delevoryas) writes:
>>: #2
>>: 	This is kind of related to #1. Our dial-in lines are set to
>>: 	auto-log out after about 20 min. of inactivity. Short of
>>: 	programming the terminal-server not to do this, how can I
>>: 	keep a process going so that it always seems like I'm doing
>>: 	something, even if I'm in the kitchen making a BLT (extra mayo).
>>: 	Just starting up some kind of loop won't do it; it has to be
>>: 	equal to a keypress from MY keyboard.
>
>Two quick thoughts:
>
>If you're using a pc at home, what about a TSR that puts a "space-CR"
>in the keyboard buffer every five minutes?

This would be a good solution, but you'd also want to put some checking
that the user was *idle* for five minutes. I can imagine it now:

% rm -rf * [hmm, do I want to do this?]
% [ OH NO, my TSR hit return for me!!! ] 

>Second, have you tried something like
>
>while :
>do
>	sleep 3600
>	echo "ls" > `tty`
>done
>
>where `tty` returns the tty device your shell is using.

I quote again from the very article you replied to:

>>: Just starting up some kind of loop won't do it; it has to be
>>: equal to a keypress from MY keyboard.

Redirecting the output of echo to your tty simply writes the text 'ls' on
your terminal. Just as if you said "echo thousandlineslong" > `tty`. It
does NOT write to the input buffer of the tty. To do so, you can use the 
TIOCSTI ioctl if you have it.

Once again, please test your solutions before you post them.

	-Kartik
Newsgroups: comp.unix.shell
From: mjo@ef2007.efhd.ford.com (Mike O'Connor)
Subject: Re: checking for mail from shell
X-Disclaimer: Not an official spokesperson for Ford OPEO
Reply-To: Mike O'Connor <mjo@fmsrl7.srl.ford.com>
Organization: International Affairs, Overseas Engineering, "Fordz"
Date: Mon, 14 Sep 1992 17:51:51 GMT

In article <1992Sep14.134158.5814@sifon.cc.mcgill.ca> anibal@ee470.ee.mcgill.ca (Anibal Jodorcovsky) writes:

:I am trying to check from .login if I have mail.
:BUT, it's not just mail what I want to do, since
:I want to specify an if...then sort of thing 
:IN CASE I have mail.
:
:Does anybody know which variable I have to check for
:in order to get a proper condition to use it in an
:if...then-like statement????

You check to see if the size of the mail file -- typically
/usr/spool/mail or /usr/mail -- is larger than 0k, and proceed from
there.  The mechanism for doing this depends on how the "test" command
works with your csh or derivative on your particular platform.

						...Mike

-- 
 Michael J. O'Connor           |  Internet:  mjo@fmsrl7.srl.ford.com
 Ford Motor Company, OPEO      |  UUCP:      ...!{backbone}!fmsrl7!mjo
 20000 Rotunda, Bldg. 1-3001   |  Phone:     +1 (313) 248-1260
 Dearborn, MI  48121           |  Fax:       +1 (313) 323-6277
Newsgroups: comp.unix.shell
From: Harald.Eikrem@delab.sintef.no
Subject: Re: Alias and awk variables
Organization: SINTEF DELAB, Trondheim, Norway.
Date: 14 Sep 92 16:16:49

! How do make this command into a csh alias,
! 
! ps -ef | awk '$1 !~ /root/ {print $0}'

  csh% alias psnot 'ps -fe | awk '\''$1 !~ /\!^/ { print }'\'
  csh% psnot root
       UID   PID  PPID  C    STIME TTY      TIME COMMAND
    daemon   127     1  0  Sep 11  ?        0:00 sendmail -bd -q30m -accepting connections
    harald 22191 22190  0 16:06:46 ttyu1    0:03 tcsh
    harald 22574 22560 15 16:07:53 ttyu1    0:00 ps -fe
    harald 22560 22191  3 16:07:05 ttyu1    0:01 csh
    harald 22190     1  0 16:06:45 ?        0:00 xterm -sb -sl 500 +si -fg black -bg #dc00d0009300 +ut -T bor
    harald 22575 22560  8 16:07:53 ttyu1    0:00 awk $1 !~ /root/ { print }
  csh%

or simpler:

  csh% alias psnot 'ps -fe | grep -v "^ *\!^ "'
  csh% psnot root
       UID   PID  PPID  C    STIME TTY      TIME COMMAND
    daemon   127     1  0  Sep 11  ?        0:00 sendmail -bd -q30m -accepting connections
    harald 22191 22190  0 16:06:46 ttyu1    0:03 tcsh
    harald 22578 22560 11 16:11:29 ttyu1    0:00 grep -v ^ *root
    harald 22560 22191  4 16:07:05 ttyu1    0:01 csh
    harald 22190     1  1 16:06:45 ?        0:01 xterm -sb -sl 500 +si -fg black -bg #dc00d0009300 +ut -T bor
    harald 22577 22560 15 16:11:29 ttyu1    0:00 ps -fe
  csh%


  ~~harald E.
Newsgroups: comp.unix.shell
From: kris@tpki.toppoint.de (Kristian Koehntopp)
Subject: Re: How to do $#a in Bourne shell?
X-Copyright: (C) Copyright 1992 Kristian Koehntopp -- All rights reserved.
		 Reproduktion, auch auszugsweise, ausserhalb elektronischer,
		 nichtkommerzieller Datennetze nur mit ausdruecklichem,
		 schriftlichem Einverstaendnis des Autors.
Organization: Toppoint Mailbox e.V.
Date: Tue, 15 Sep 1992 08:51:48 GMT
X-Excuse: X-Copyright wegen Emma, Suedwestpresse und /C'T/DISKUSSIONEN.

In <1992Sep12.022450.20682@sq.sq.com> msb@sq.sq.com (Mark Brader) writes:
>	listcount=`set dummy $list; shift; echo $#`

This is a kludge. Use "--" instead:

listcount=`set -- $list; echo $#`

Of course there are certainly shells which fail to understand
"--" as "end of options".

Kristian
-- 
Kristian Koehntopp, Harmsstrasse 98, FRG W-2300 Kiel, +49 431 676689
"Look up!"
	-- Asylum


Newsgroups: comp.unix.shell
From: bateman@nsslsun.nssl.uoknor.edu (Monte Bateman)
Subject: FAQ, Please!
Originator: usenet@kittyhawk.ecn.uoknor.edu
Date: Sat, 12 Sep 1992 17:30:23 GMT
Organization: National Severe Storms Laboratory

Could someone direct me to the FAQ for this group, please?!

Thanks,

Monte

--
===============================================================================
Monte Bateman, WB5RZX
Physics Ph.D. Candidate at The University of Oklahoma 
& The National Severe Storms Laboratory, Norman, OK! 

InterNet: bateman @ nsslsun.nssl.uoknor.edu
Packet Radio: WB5RZX @ WB5RZX.OK.USA.NOAM
From: guenther@StOlaf.edu (Philip Guenther)
Newsgroups: comp.unix.shell
Subject: Re: seding with variables and /s question
Date: 13 Sep 92 01:15:19 GMT
Organization: St. Olaf College, Northfield, MN USA

In article <lb4q5tINNaef@jethro.Corp.Sun.COM> tmhoff@oogoody.Corp.Sun.COM (Todd Hoff) writes:

>    I'm having a hard time using variables to specify search patterns
> containind /s in sed. Say my home development directory path is in
> $DEVEL and my destination path is in $DEST. Since these are path
> specifications they contain /s and when I do something like: sed -e
> 's/$DEVEL/$DEST/' $file > $destfile sed barfs on the /s. I've tried
> lots of variations. Any clues? 

>   Thanx

A quick check of the sed(1) man page shows...

  (2)s/regular expression/replacement/flags [...]
           Any character may be used instead of `/'.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Also, neither csh nor sh do variable substitution within single
quotes, so you would want to enter:

sed -e "s:$DEVEL:$DEST:" $file > $destfile

In fact, as ":" isn't a special character, you needn't do any quoting.
Now if $DEVEL or $DEST contained special characters/whitespace...

Philip Guenther
--
guenther@stolaf.edu (Philip Guenther)       | The ACC might agree with me,
Student Sys Prog, Academic Computing Center | but with that bunch, (and me)
St Olaf College, Northfield, MN 55057-1001  | you never know... :-) :-| :-(
"Life makes sense?  LIFE MAKES SENSE!!?  Where do people get these ideas?"-me
Newsgroups: comp.unix.shell
From: tinsel@uiuc.edu (Thomas Aaron Insel)
Subject: Re: zork shell
Originator: tai50080@uxa.cso.uiuc.edu
Reply-To: tinsel@uiuc.edu
Organization: Illini Mastication Society
Date: Sat, 12 Sep 1992 23:55:26 GMT

subbarao@tex.Princeton.EDU (Kartik Subbarao) writes:

> >When I read the original post, I thought he meant something like the 
> >Adventure Shell. 

> Correct -- What the poster wants is 'ash', the Adventure Shell, not zsh,
> the Z-shell.

Can anyone tell me where I can find this?  Archie lists a dozen or so
copies available of "ash", from comp.sources.unix v.19, I think, but
this is hacked SysV shell, not the adventure shell.
-- 
Thomas Aaron Insel (tinsel@uiuc.edu)
  "We must not confuse dissent with disloyalty." -- Edward R. Murrow
Newsgroups: comp.unix.shell
From: lappala@unlinfo.unl.edu (Kris Lappala)
Subject: ex editor options 
Keywords: ex silence option
Organization: University of Nebraska - Lincoln
Distribution: g
Date: Wed, 9 Sep 1992 15:15:13 GMT

I am using the ex editor in a shell file and wish to suppress the 
interactive feedbaack to the user.  I have read the man page on ex
wish shows the option to be - | -s.   
I beleive my problem is syntax but can't quite figure it out.  Here is 
a copy of the shell program:
string="`grep $1 ${CSHRC}`"

/**********************************************/

if [ -z "$string" ]
then
echo "setenv $1 $2" >> ${CSHRC}

else
ex - | -s  ${CSHRC} <<-end_of_edit
/setenv *$1
d
i
setenv $1 $2
.
w
q
end_of_edit

fi


/**********************************************/


if anyone can help please send a reply to:
lappala@cse.unl.edu
thanks
From: urs@carp.cis.ufl.edu (Uppili Srinivasan)
Newsgroups: comp.unix.shell
Subject: Substring of a file name
Date: 10 Sep 92 15:15:41 GMT
Distribution: usa
Organization: Univ. of Florida CIS Dept.

Hi,

I need to write a script to read a substring of some of the filenames

in a directory. (i.e) if xy1992 is the name i need to read the last four

letters only. I guess 'awk' is ideal for this . But I am curious to

know the other ways of doing this.


Thanx in advance

My e-mail address : urs@carp.cis.ufl.edu
From: yared@typhon.enst.fr (Nadim Yared)
Newsgroups: comp.unix.shell
Subject: Re: Problem to alias
Date: 7 Sep 92 15:53:07 GMT
Organization: Telecom Paris, France

In article <1992Sep5.144042.3171@leland.Stanford.EDU>, peer@ccrma.stanford.edu (Peer Landa) writes:
-> 
-> I have some problem to alias the following command:
-> rsh remote_host dir/App -NXHost current_host&
-> 		
-> 
-> In my .cshrc I tried to:
-> alias  rshh  'rsh \!:1 \!:2 -NXHost hostname&'
->  . but it doesn't work.  Any suggestions?
-> 
-> -- peer

Try 

     alias rshh 'rsh \!\!:1 \!\!:2 -NXHost hostname&'

Regards.
From: malenovi@plains.NoDak.edu (Malenovic Nikola V.)
Newsgroups: comp.unix.shell
Subject: Re: Automating telnet
Keywords: telnet, here documents, automatic login
Date: 10 Sep 92 16:48:42 GMT
Article-I.D.: plains.20265
Organization: North Dakota Higher Education Computing Network

In article <ellis.715831025@nova> ellis@nova.gmi.edu (Stew Ellis) writes:
>  telnet remote.host << EOF
>  loginname
>  EOF
>
>The man page for telnet is of no help on this.  I am probably missing
>something obvious to someone, but it is not obvious to me. :(
>
>Thank you for any help.
>  R.Stewart(Stew) Ellis, Assoc.Prof., (Off)313-762-9765  /   _____  ______ 

Since I had a lot of people asking me, I think this stuff oughta be in FAQ...
(pliz pliz pliz put it there...)...

the answer to above question is : the easiest way is to write your own
'telnet'. It is fairly easy under BSD-style machines - I have a code (two
short procedures + main) that is fairly short, and does the job of opening
the socket to the address I want and to the port I want. The problem is that
you still have to do the programming such as sending commands via the socket
etc. but, IMHBO, it's piece of cake... In case anyone wants I can bounce a
copy of source (in C) code...

Nikola Malenovic
malenovi@plains.nodak.edu
--
Newsgroups: comp.unix.shell
From: hofer@Informatik.TU-Muenchen.DE (Robert Hofer)
Subject: Re: Substring of a file name
Organization: Technische Universitaet Muenchen, Germany
Date: Fri, 11 Sep 1992 20:15:44 GMT

Hi!

Dont forget the ksh feature "variable substitution" with #, ##, %, %%
Here a short example:

#!/bin/ksh

#set -x +v
a=${1%%[0-9][0-9][0-9][0-9]}
b=${1##$a}
if [ "$b" = "" ]; then
	echo Cant split $1
else
	echo $1 = \($a\)\($b\)
fi

And for your problem it looks like ...

echo *[0-9][0-9][0-9][0-9] | tr ' ' '\012' |
	while read fn; do
		if [ ! -d $fn -a ( -f $fn -o -L $fn ) ]; then
			part1=${fn%%[0-9][0-9][0-9][0-9]}
			part2=${fn##$part1}
			... do the rest ...
		fi
	done

Hope this helps,
Robert
-- 
| Robert Hofer TU Muenchen             local ::= informatik.tu-muenchen.de
| WIN: hofer@{local}                   UUCP: hofer%{local}@unido.uucp
From: akachhy@cbnewsl.cb.att.com (avinash.kachhy)
Newsgroups: comp.unix.shell
Subject: Problem with cd in ksh
Date: 11 Sep 92 15:42:00 GMT
Organization: AT&T

I am using kah on a SUN machine running SunOS. When I execute
cd anydir
I get an error message from ksh that "anydir was not found"
I must execute the cd command as follows to change directory.
cd ./anydir

I will appreciate a solution for this problem.
Please send email to attmail!akachhy

Thanks.

Avinash Kachhy
attmail!akachhy
From: swlodin@kocrsv01.delcoelect.com (Steve Lodin)
Newsgroups: comp.unix.shell
Subject: Re: Any known bugs for tcsh (6.02)
Date: 9 Sep 92 17:15:18 GMT
Organization: Delco Electronics Corp.
Originator: swlodin@kocrsw15


I also have no difficulty with tcsh 6.01 on HP300 or HP700
architectures.  That reminds me, where is tcsh archived?  I only have
version 6.01 and you are talking about 6.02.

Steve
-- 
Steve Lodin	Internet: swlodin@kocrsv01.delcoelect.com  UUCP: deaes!swlodin


		"So much news, so little time."
From: sweh@spuddy.uucp (Stephen Harris)
Newsgroups: comp.unix.shell
Subject: Re: KSH: how to stop $ENV
Date: 12 Sep 92 10:18:32 GMT
Organization: Spuddy's Public Usenet Domain

In article <1992Sep11.132901.26395@bnr.ca> space%bnr.ca (Scott Pace) writes:
>I have a shell script written in ksh (i.e. has #! /bin/ksh at the start).
>How do I prevent the ksh from executing $ENV?  This is on HP-UX 7.05.  I

You need to run in priviledged modee (or is it protected mode?  Never can
remember).
Anyway, #!/bin/ksh -p
will do the job.

If a ksh script is suid, then the -p should be applied automatically.
-- 
                               Stephen Harris
               sweh@spuddy.uucp    ...!uknet!axion!spuddy!sweh

 * Meeeeow ! Call Spud the Cat on > +44 203 638780 < for free Usenet access *
Newsgroups: comp.unix.shell