Re: BASH Shell Scripting Question

2003-06-27 Thread Richard Crawford
Thanks to everyone who replied to this question. I wound up doing it in Perl. ;-) Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] "It is only with the heart that we see rightly; what is essential is invisible to the eye."

Re: BASH Shell Scripting Question

2003-06-27 Thread pnelson
On Fri, 2003-06-27 at 09:43, Richard Crawford wrote: > Greetings, > > I have a shell script which duplicates a file and then renames the > duplicate file; the trick is that the duplicate file needs to have the > same permissions as the original file. For example: > > 1. Open file A.txt > 2.

Re: BASH Shell Scripting Question

2003-06-27 Thread Gordon Messmer
Richard Crawford wrote: ... 5. Give B.txt the same permissions as A.txt I assume that there is some set of variables I can look at to find various attributes of A.txt, so that $APerm = permissions(A.txt) or something, so I can do chmod $APerm B.txt in step 5. From the "setfacl" man page:

Re: BASH Shell Scripting Question

2003-06-27 Thread Bret Hughes
On Fri, 2003-06-27 at 11:43, Richard Crawford wrote: > Greetings, > > I have a shell script which duplicates a file and then renames the > duplicate file; the trick is that the duplicate file needs to have the > same permissions as the original file. For example: > > 1. Open file A.txt > 2.

BASH Shell Scripting Question

2003-06-27 Thread Richard Crawford
Greetings, I have a shell script which duplicates a file and then renames the duplicate file; the trick is that the duplicate file needs to have the same permissions as the original file. For example: 1. Open file A.txt 2. Manipulate A.txt 3. Save A.txt as A.txt.tmp 4. Rename A.txt.tmp t

Re: Shell Scripting Question

2003-06-24 Thread Cameron Simpson
On 08:21 24 Jun 2003, Jon Haugsand <[EMAIL PROTECTED]> wrote: | * Cameron Simpson | > | > I tend to do this: | > find dir -type f -name '*.html' -exec bsed 's|this|long/thing/with/slashes/this|g' {} ';' | > or just: | > bsed 's|this|long/thing/with/slashes/this|g' *.html | > for just the .

Re: bsed (was: Re: Shell Scripting Question)

2003-06-24 Thread Cameron Simpson
On 08:22 24 Jun 2003, Jon Haugsand <[EMAIL PROTECTED]> wrote: | * Cameron Simpson | > You can get bsed here: | > | > http://www.cskk.ezoshosting.com/cs/scripts/bsed | > | > An extremely useful wrapper for sed. | | Not much information here, is it? Can you give a short tutorial? You treat it

bsed (was: Re: Shell Scripting Question)

2003-06-23 Thread Jon Haugsand
* Cameron Simpson > You can get bsed here: > > http://www.cskk.ezoshosting.com/cs/scripts/bsed > > An extremely useful wrapper for sed. Not much information here, is it? Can you give a short tutorial? -- Jon Haugsand, [EMAIL PROTECTED] http://www.norges-bank.no -- redhat-list mailing

Re: Shell Scripting Question

2003-06-23 Thread Jon Haugsand
* Cameron Simpson > > I tend to do this: > find dir -type f -name '*.html' -exec bsed > 's|this|long/thing/with/slashes/this|g' {} ';' > or just: > bsed 's|this|long/thing/with/slashes/this|g' *.html > for just the .html files in the current directory. As far as I understood the quest

Re: Shell Scripting Question

2003-06-23 Thread Cameron Simpson
On 16:18 23 Jun 2003, Richard Crawford <[EMAIL PROTECTED]> wrote: | Jonathan Bartlett said: | > I'm very curious why you want this. Anyway, basically, go to the top | > level and run this perl script( NOTE - I haven't even tested this to see | > if it will compile, so it will likely delete all you

Re: Shell Scripting Question

2003-06-23 Thread Richard Crawford
Jonathan Bartlett said: > I'm very curious why you want this. Anyway, basically, go to the top > level and run this perl script( NOTE - I haven't even tested this to see > if it will compile, so it will likely delete all your files and set your > computer on fire. But it should give you a starti

Re: Shell Scripting Question

2003-06-23 Thread Richard Crawford
Jonathan Bartlett said: > I'm very curious why you want this. Anyway, basically, go to the top > level and run this perl script( NOTE - I haven't even tested this to see > if it will compile, so it will likely delete all your files and set your > computer on fire. But it should give you a starti

Re: Shell Scripting Question

2003-06-23 Thread Jonathan Bartlett
I'm very curious why you want this. Anyway, basically, go to the top level and run this perl script( NOTE - I haven't even tested this to see if it will compile, so it will likely delete all your files and set your computer on fire. But it should give you a starting point): #!/usr/bin/perl sub

RE: Shell Scripting Question

2003-06-23 Thread Brian Lucas
Title: RE: Shell Scripting Question Make a script using the below.  Then change to your highest folder and then run: # sh name_of_script.sh *.htm -- #!/bin/ksh tmpdir=tmp.$$ mkdir $tmpdir.new for f in $* do     sed -e 's/action="" href="http://www.the

Shell Scripting Question

2003-06-23 Thread Richard Crawford
I have an urgent need inside a shell script to replace a filename within an html file with the absolute url to the file. For example, http://www.thesite.com/theform.html calls a CGI script. The FORM tag looks like this: < form name="thisForm" method="post" action="myScript.pl" > What I need to

Re: Scripting question

2002-12-04 Thread Thierry ITTY
>> >From a script: main.sh, I need to: >> 1. Copy file ./x to /tmp/x >> 2. Read a variable from stdin, for example: read VALUE >> 3. Search through file /tmp/x for the keyword REPLACE, and replace it with ${VALUE} >> >> I can't seem to figure out what combination of sed, perl, whatever I can use.

RE: Scripting question

2002-12-04 Thread Niessen, Klif
Just replace the single quotes with double quotes. Single quotes are keeping the $vars from being evaluated. sed "s/REPLACE/${VALUE}/g" /tmp/x > /tmp/x.new Klif -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinf

Re: Scripting question

2002-12-04 Thread Johnathan Bailes
On Tue, 2002-12-03 at 15:54, Shaw, Marco wrote: > >From a script: main.sh, I need to: > 1. Copy file ./x to /tmp/x > 2. Read a variable from stdin, for example: read VALUE > 3. Search through file /tmp/x for the keyword REPLACE, and replace it with ${VALUE} > > I can't seem to figure out what comb

Re: Scripting question

2002-12-03 Thread Bret Hughes
On Tue, 2002-12-03 at 14:54, Shaw, Marco wrote: > >From a script: main.sh, I need to: > 1. Copy file ./x to /tmp/x > 2. Read a variable from stdin, for example: read VALUE > 3. Search through file /tmp/x for the keyword REPLACE, and replace it with ${VALUE} > > I can't seem to figure out what comb

Scripting question

2002-12-03 Thread Shaw, Marco
>From a script: main.sh, I need to: 1. Copy file ./x to /tmp/x 2. Read a variable from stdin, for example: read VALUE 3. Search through file /tmp/x for the keyword REPLACE, and replace it with ${VALUE} I can't seem to figure out what combination of sed, perl, whatever I can use. Marco main.sh: #

Re: Bash Shell Scripting Question

2002-10-28 Thread Todd A. Jacobs
On Sat, 26 Oct 2002, MET wrote: > if[ $MANPATH ] ; then It's telling you it can't tokenize the expressions, right? Spacing and quoting are not optional for this construct. And where is the test condition? How about changing all your tests to something like: if [ -n "$MANPATH" ]; then

Re: Bash Shell Scripting Question

2002-10-26 Thread Michael Schwendt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sat, 26 Oct 2002 16:42:34 -0400, MET wrote: > I'm trying to start using Qt and I'm having problems setting up the > environmental variables so I guess I'm off to a pretty bad start. > Below is what I have included in my /etc/profile minus the defa

Bash Shell Scripting Question

2002-10-26 Thread MET
I'm trying to start using Qt and I'm having problems setting up the environmental variables so I guess I'm off to a pretty bad start. Below is what I have included in my /etc/profile minus the defaults and the export commands. My export commands are fine as the rest of my variables work except fo

Re: bash scripting question

2002-10-26 Thread Steve Borho
On Wed, Oct 23, 2002 at 09:06:03PM -0500, christopher j bottaro wrote: > hello, > first off, are there any mailing lists where i can ask questions about bash > scripting? any good mailing list that deal with programming c in linux? > > anyways, i want to assign the exit status of a command in a

Re: bash scripting question

2002-10-24 Thread Andrew MacKenzie
> > You can't do that. Bash has a builtin variable ("$?") for holding the exit > > status, which you can then reassign to another variable if you need to > > store it for later use. For example: > > > > x=$? > > ok, but what if i want to capture the exit status of grep in the following > comm

Re: bash scripting question

2002-10-24 Thread Todd A. Jacobs
On Wed, 23 Oct 2002, christopher j bottaro wrote: > configure exited successfully, but also tee its output to a file and > grep it for any warnings about missing packages before i go on to > compile it. I think you're making it more complicated than it needs to be. You can create it as a series

Re: bash scripting question

2002-10-23 Thread christopher j bottaro
On Wednesday 23 October 2002 10:04 pm, Todd A. Jacobs wrote: > I spend a lot of time on the Moongroup shell.scripting list at: > > http://moongroup.com/mailman/listinfo/shell.scripting cool, i just joined that. > You can't do that. Bash has a builtin variable ("$?") for holding the exit > sta

Re: bash scripting question

2002-10-23 Thread Andrew MacKenzie
> hello, > first off, are there any mailing lists where i can ask questions about bash > scripting? any good mailing list that deal with programming c in linux? > > anyways, i want to assign the exit status of a command in a variable as an > integer. i tried the following: > let x=`./configure

Re: bash scripting question

2002-10-23 Thread Todd A. Jacobs
On Wed, 23 Oct 2002, christopher j bottaro wrote: > first off, are there any mailing lists where i can ask questions about > bash scripting? I spend a lot of time on the Moongroup shell.scripting list at: http://moongroup.com/mailman/listinfo/shell.scripting > anyways, i want to assign the

Re: bash scripting question

2002-10-23 Thread Roger
Around Wed,Oct 23 2002, at 09:06, christopher j bottaro, wrote: > hello, > first off, are there any mailing lists where i can ask questions about bash > scripting? any good mailing list that deal with programming c in linux? > > anyways, i want to assign the exit status of a command in a varia

Re: bash scripting question

2002-10-23 Thread Bret Hughes
On Wed, 2002-10-23 at 21:06, christopher j bottaro wrote: > hello, > first off, are there any mailing lists where i can ask questions about bash > scripting? moongroup.com shell-scripting list really low volume but some VERY sharp folks there. Several of which pop up on this list occasionally

RE: bash scripting question

2002-10-23 Thread Chad Skinner
> anyways, i want to assign the exit status of a command in a > variable as an > integer. i tried the following: > let x=`./configure --prefix=$1` > but it doesn't work. according to my book if ./configure --prefix = $1 then ... else ... fi -- redhat-list mailing list unsubscribe ma

bash scripting question

2002-10-23 Thread christopher j bottaro
hello, first off, are there any mailing lists where i can ask questions about bash scripting? any good mailing list that deal with programming c in linux? anyways, i want to assign the exit status of a command in a variable as an integer. i tried the following: let x=`./configure --prefix=$1`

Re: Scripting question on a "case" construct (THANKS!)

2002-07-19 Thread Joe Nestlerode
Thanks to both of you for responding. The empty quotes works best for what I wanted to do (which I should have been clearer on in the first place). I wanted to make the first choice in a menu the "default", ie, just hit , and the empty quotes allow me to do that: echo -e " Your selection, pl

Re: Scripting question on a "case" construct

2002-07-18 Thread Cameron Simpson
On 14:05 18 Jul 2002, Joe Nestlerode <[EMAIL PROTECTED]> wrote: | Can you put a carriage return (enter) as one of the choices in a 'case' | construct? *) will catch it, but I need that for the "Invalid Choice" | catch-all at the end. I couldn't find it in the documentation; is this | possible

Re: Scripting question on a "case" construct

2002-07-18 Thread Stephen Spalding
Now that I think about it, you asked for how to check for a response of just cr-lf. Here's what I should have sent you: #!/bin/bash echo "Please answer yes or no: " read answer if [ x"$answer" = x"" ]; then echo echo "*** Invalid Response! ***" echo exit -1 fi

Re: Scripting question on a "case" construct

2002-07-18 Thread Stephen Spalding
I think what I would do is put a check in for an empty response before the case statement is ever reached. Here's an example of what I mean: #!/bin/bash echo "Please answer yes or no: " read answer if [[ x"$answer" != x"yes" && x"$answer" != x"no" ]]; then echo echo "*** Invalid

Scripting question on a "case" construct

2002-07-18 Thread Joe Nestlerode
Hello, Can you put a carriage return (enter) as one of the choices in a 'case' construct? *) will catch it, but I need that for the "Invalid Choice" catch-all at the end. I couldn't find it in the documentation; is this possible? Thanks, Joe [EMAIL PROTECTED] __

Re: Scripting question - script to find and delete files

2002-07-12 Thread Saul Arias
On Fri, 2002-07-12 at 15:56, Joe Nestlerode wrote: > Thank you, that works beautifully. I modified it slightly to allow a > user to enter a search pattern on the command line, to wit: > > #!/bin/sh > > echo -e "Enter a file or pattern to search for...\n" > read file > > for i in `find . -name

Re: Scripting question - script to find and delete files

2002-07-12 Thread Joe Nestlerode
Saul, Thank you, that works beautifully. I modified it slightly to allow a user to enter a search pattern on the command line, to wit: #!/bin/sh echo -e "Enter a file or pattern to search for...\n" read file for i in `find . -name "$file"` do rm -i $i done exit 0 Thanks again! Joe [EMA

Re: Scripting question - script to find and delete files

2002-07-12 Thread Saul Arias
On Fri, 2002-07-12 at 13:13, Joe Nestlerode wrote: > I'm trying to write a simple script to search a directory tree for a > file pattern (specified as an argument with a wildcard, ie, testfile* or > *.jpg), and then delete matching files after first prompting the user > for a y/n. (yes=delete,

Scripting question - script to find and delete files

2002-07-12 Thread Joe Nestlerode
Hello, I'm trying to write a simple script to search a directory tree for a file pattern (specified as an argument with a wildcard, ie, testfile* or *.jpg), and then delete matching files after first prompting the user for a y/n. (yes=delete, no=don't delete, find the next match) The followin

Re: Bash scripting question

2000-11-13 Thread Charles Galpin
Hi Russ Use any one of your existing autoreply recipes (that I know you already have:) ) as a starting point. What you want to do is extract the address of the person to replay to, and execute your script. It's that easy. An UNTESTED guess would be :0: * ^To: send.qym.vet.pics { FROM=`formail

Re: Bash scripting question

2000-11-12 Thread Bret Hughes
[EMAIL PROTECTED] wrote: > On Sat, 11 Nov 2000, Marco Shaw wrote: > > Mutt will help you here: > > #>for each in `find . -name "*.jpg"` > > >do > > >mutt -a $each -s "your subject" to_address < /dev/null > > >done > > This will recursively go through the present working directory, and ema

Re: Bash scripting question

2000-11-12 Thread Marco Shaw
I'm going to think about this one... I don't think procmail is the correct route, and would think that sendmail and/or a listserv app like majordomo would be the better route. I know there's an app (custom?) that responds to commands when you specify them in the body of the email, but I don't kn

Re: Bash scripting question

2000-11-11 Thread Marco Shaw
Mutt will help you here: #>for each in `find . -name "*.jpg"` >do >mutt -a $each -s "your subject" to_address < /dev/null >done This will recursively go through the present working directory, and email all jpgs as attachments to the email address replacing 'to_address'. This will send them one-

RE: Bash scripting question

2000-11-11 Thread Mike Lewis
PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Bash scripting question I'd like something like this also. Please let me know if you find anything. Thanks. -- -Time flies like the wind. Fruit flies like a banana. Stranger things have - -happened but none stranger than this. Does your driver's l

Re: Bash scripting question

2000-11-11 Thread Steven W. Orr
I'd like something like this also. Please let me know if you find anything. Thanks. -- -Time flies like the wind. Fruit flies like a banana. Stranger things have - -happened but none stranger than this. Does your driver's license say Organ -Donor?Black holes are where God divided by zero. List

Re: Simple Shell Scripting Question

2000-10-15 Thread Nic Steussy
x | grep pppd | grep -v grep | awk '{print $2}'`" fi echo "He's dead Jim, He's dead." --- - Original Message - From: "Kevin Diffily" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, October 14, 2

Re: Simple Shell Scripting Question

2000-10-14 Thread Steven W. Orr
Someone suggested that you use killall, but I don't think that really answers your question. -- -Time flies like the wind. Fruit flies like a banana. Stranger things have - -happened but none stranger than this. Does your driver's license say Organ -Donor?Black holes are where God divided by zer

RE: Simple Shell Scripting Question

2000-10-14 Thread David Kramer
Uncle Meat wrote: > > On 15-Oct-2000 Kevin Diffily spoke something to the effect: > > I have been unable to create a simple program that will kill a > > running ppp connection. I have tried > > cat /var/run/ppp0|kill > > echo /var/run/ppp0|kill > > kill > etc. kill `cat /var/run/ppp0` Use bac

RE: Simple Shell Scripting Question

2000-10-14 Thread Uncle Meat
On 15-Oct-2000 Kevin Diffily spoke something to the effect: > I have been unable to create a simple program that will kill a > running ppp connection. I have tried > cat /var/run/ppp0|kill > echo /var/run/ppp0|kill > kill etc. > > Any help will be appreciated. Here's one that will work if us

Re: Simple Shell Scripting Question

2000-10-14 Thread Mike Burger
How about "killall -9 ppp On Sat, 14 Oct 2000, Kevin Diffily wrote: > I have been unable to create a simple program that will kill a > running ppp connection. I have tried > cat /var/run/ppp0|kill > echo /var/run/ppp0|kill > kill etc. > > Any help will be appreciated. > _

Simple Shell Scripting Question

2000-10-14 Thread Kevin Diffily
I have been unable to create a simple program that will kill a running ppp connection. I have tried cat /var/run/ppp0|kill echo /var/run/ppp0|kill killhttps://listman.redhat.com/mailman/listinfo/redhat-list