Re: Bash Script question

2003-01-10 Thread Robert P. J. Day
On Thu, 9 Jan 2003, David Busby wrote: > List, > I've got a bash script, that executes other scripts (wow!) and the sub > scripts return a value. > How can I get the parent script to capture that return value? I've been all > over the BASH manual (more than one hour) and Google, still no luck

Re: Bash Script question

2003-01-09 Thread Ashley M. Kirchner
David Busby wrote: Here's the BASH code that I currently have #!/bin/bash for YEAR in 2003 2004 2005 2006 do CMD="./import.php $YEAR" $CMD done #!/bin/bash for YEAR in $(seq 2003 1 2006) do ./import.php $YEAR RETVAL=$? echo $RETVAL; done You can create different RETVALs if you

Re: Bash Script question

2003-01-09 Thread David Busby
to the number of items it imported. I would like BASH to trap this value and at the end echo the total of the 4 script executions. /B - Original Message - From: "Todd A. Jacobs" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 19:39 Subject:

Re: Bash Script question

2003-01-09 Thread Todd A. Jacobs
On Thu, 9 Jan 2003, David Busby wrote: > How can I get the parent script to capture that return value? I've been > all over the BASH manual (more than one hour) and Google, still no luck. Not sure what you're really trying to do. If you posted real code, that would help. The exit status of th

Re: Bash Script Question

2002-11-06 Thread Robert P. J. Day
On Wed, 6 Nov 2002, Hella wrote: > You want to use sed and awk for a truly robust solution. a sadly-overlooked but useful text processing command is "expr". $ man expr which can do simple things like matching, extraction, length, substr and stuff like that. check it out before going on to sed,

Re: Bash Script Question

2002-11-06 Thread Hella
You want to use sed and awk for a truly robust solution. If you need further help, I can dig up examples of doing this. Generally, when I need to do text processing, I turn to perl. However, this can be done in bash, but larger tasks will get ugly in bash. -Chuck John H Darrah wrote: On Mon,

Re: Bash Script Question

2002-11-05 Thread John H Darrah
On Mon, 4 Nov 2002, Chad Skinner wrote: > Is there a way in a bash script to trim the spaces from the front and end of > a variable > > I have a script that contains the following variable definition > > > BLOCKED_SERVICES="tcp,111,Sun RPC;\ > udp,111,Sun RPC;\ >

RE: Bash Script Question

2002-11-05 Thread Cowles, Steve
> -Original Message- > From: mark > Subject: Re: Bash Script Question > > > For example, with a datafile, you could then say > export BLOCKED_SERVICES=`cat myblocked` but where you > need the services broken out, youi would want to use awk: > > # start o

Re: Bash Script Question

2002-11-05 Thread mark
On Tuesday 05 November 2002 09:51 am, Chad is done writ: > Is there a way in a bash script to trim the spaces from the front and > end of a variable > I have a script that contains the following variable definition > BLOCKED_SERVICES="tcp,111,Sun RPC;\ >udp,111,Sun

RE: Bash Script Question

2002-11-05 Thread mail-lists
you can use xargs to get rid of that whitespace in the protocol declaration: BLOCKED_SERVICES="tcp,111,Sun RPC;\ udp,111,Sun RPC;\ tcp,443,Microsoft DS;\ udp,443,Microsoft DS" IFS=";" for SERVICE in $BLOCKED

Re: Bash Script Question

2002-11-04 Thread Todd A. Jacobs
On Mon, 4 Nov 2002, Chad Skinner wrote: > Is there a way in a bash script to trim the spaces from the front and end of > a variable Not the way you're doing it. The easiest thing to do is to change your data representation, rather than spending a lot of time trying to strip whitespace. Try:

RE: Bash Script Question

2002-11-04 Thread Cowles, Steve
> -Original Message- > From: Chad Skinner > Subject: Bash Script Question > > > Is there a way in a bash script to trim the spaces from the > front and end of a variable > > I have a script that contains the following variable definition > > > BLOCKED_SERVICES="tcp,111,Sun RPC;

Re: bash script question (for loops)

2000-11-27 Thread David Talkington
-BEGIN PGP SIGNED MESSAGE- Matthew Melvin wrote: > >You can use $IFS to tell bash to split on just the line feeds instead of the >spaces >[mloe@riverbank (1) bashtest]$ IFS=' >> ' Brilliant, thank you -- this was driving me nuts. I finally figured out that the reason this works: LI

Re: bash script question (for loops)

2000-11-27 Thread David Talkington
-BEGIN PGP SIGNED MESSAGE- Mark - You're right, that's an odd inconsistency. I thought perhaps we could modify IFS, but it uses space/tab/newline by default, yet it doesn't seem to be splitting on the space in the first example. (I would think it should.) These two commands produce i

Re: bash script question (for loops)

2000-11-26 Thread Statux
Use quotes.. these things ---> " " :) I didn't get to read your whole message, but quotes protect text from default parameterization rules of the shell, etc. Therefore: cat "Filename with spaces.txt" will.. well.. you get the idea A common script I do do is like: for f in *.c do echo -e "$f"

Re: bash script question (for loops)

2000-11-26 Thread Todd A. Jacobs
Put double-quotes around your variables. :) -- Todd A. Jacobs Senior Network Consultant ___ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list

Re: bash script question (for loops)

2000-11-26 Thread Matthew Melvin
On Sat, 25 Nov 2000, Mark Ivey wrote: > Here are two more scripts, similar to the first 2: >LIST=*; for NAME in $LIST; do echo "-->" $NAME; done >LIST=$(\ls); for NAME in $LIST; do echo "-->" $NAME; done > > They give different output. The first one gives: >--> Astral Projection