Re: Bash Scripting Question

2013-11-07 Thread Chris Davies
Jonathan Dowland wrote: > On Sun, Nov 03, 2013 at 09:58:58PM +0100, Erwan David wrote: >> Maybe you'll need something like expect to handle this. > I'd second expect, it's probably the best tool for the job in all > non-trivial cases. The "empty-expect" package, perhaps? Chris -- To UNSUBSCRI

Re: Bash Scripting Question

2013-11-05 Thread Zenaan Harkness
On 11/4/13, Thomas H. George wrote: > The script I am trying to write executes a program that requires a > keyboard response. I have experimented with redirecting STDIN but haven't > found the > correct way to make the response. To read a value (perhaps half your "problem"): apt-cache show ... z

Re: Bash Scripting Question

2013-11-04 Thread Karl E. Jorgensen
trying to do "crazy" stuff, e.g. like removing essential packages. Even the simpler questions are there to give you a chance not to shoot yourself in the foot: If you script the answers to them, your (metaphorical) foot is in danger... > I'm sure this must be elementary but I have

Re: Bash Scripting Question

2013-11-04 Thread Jonathan Dowland
The tool 'yes' can be used to write an infinite stream of strings (the default being 'y') to standard output, so if your program needed only a sequence of a fixed string such as 'y', you could do > yes | your-program or > yes "some-other-string" | your-program But if your program is not readin

Re: Bash Scripting Question

2013-11-03 Thread Erwan David
e > response from apt-get install for the letter y and fed this back to > install . In my case I must respond with a word in answer to the > programs question. > > I'm sure this must be elementary but I have read large sections of > BASH GUIDE FOR BEGINNERS and AVANCE

Re: Bash Scripting Question

2013-11-03 Thread Cousin Stanley
> The script I am trying to write executes a program > that requires a keyboard response. > A varaible can be set to a keyboard response using a read prompt read -e -p "What do you need ?" xVariable echo $xVariable -- Stanley C. Kitching Human Being Phoenix, Arizon

Bash Scripting Question

2013-11-03 Thread Thomas H. George
ck to install . In my case I must respond with a word in answer to the programs question. I'm sure this must be elementary but I have read large sections of BASH GUIDE FOR BEGINNERS and AVANCED BASH-SCRIPTING GUIDE without finding a solution. I would appreciate a little help or ad

Re: OT: A question about bash scripting

2012-10-30 Thread Ralf Mardorf
On Tue, 30 Oct 2012 08:58:31 +0100, Chris Davies wrote: done=$(date +%s) month=$(date --date @$done +%B) mon=$(date --date @$done +%b) d_y_t=$(date --date @$done +'/%d/%Y %T') I agree, good idea. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subj

Re: OT: A question about bash scripting

2012-10-30 Thread Chris Davies
Ralf Mardorf wrote: > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) You've got a horrible race condition in there just waiting to bite you. Try this instead: done=$(date +%s) month=$(date --date @$done +%B) mon=$(date --date @$done +%b) d_y_t

[sloved] OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 18:52 -0400, Neal Murphy wrote: > What's the '+100' supposed to do? ### Killall and Restore session started=$(date +%s) SECONDS=0 sleep 2 ### Time month=$(date +%B) mon=$(date +%b) d_y_t=$(date '+/%d/%Y %T') done=$(date +%s) done_2=$SECONDS ((seconds=(done-start

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 21:31 +, Dom wrote: > Would this do what you are after? > > ### Killall and Restore session > started=$(date +%s) > sleep 2 > > ### Time > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) > echo > printf "Attended time to restore sessio

Re: OT: A question about bash scripting

2012-10-29 Thread Neal Murphy
On Monday, October 29, 2012 04:31:03 PM Ralf Mardorf wrote: > FOR YOUR EXAMPLE, IIUC IT SHOULD BE? ... > > ### Killall and Restore session > started=$(date +%s) > sleep 2 > > ### Time > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) > #((seconds=(don

Re: OT: A question about bash scripting

2012-10-29 Thread Dom
On 29/10/12 20:31, Ralf Mardorf wrote: (trimmed) I want ((seconds=(done-started)-(((done-started)/60)*60)+100)) min_sec=$(((done-started)/60))":"${seconds: -2} in one line, instead of two lines. I don't understand your reply. Even if I would add ${min_sec: 2} to each "echo" command (ther

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
> ... WHILE I WONT THIS 2 lines, AS ONE LINE, INCLUDING THE FORMATTING: Oops, an evil typo ;), it should be "... while I want". The capital letters aren't for shouting, just to distinguish the mail's text from the script. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 15:59 -0400, Neal Murphy wrote: > On Monday, October 29, 2012 03:26:20 PM Ralf Mardorf wrote: > > > On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > > > > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > > > > > > > > wrote: > > > > > Hi :) > > > > > > > > > >

Re: OT: A question about bash scripting

2012-10-29 Thread Neal Murphy
On Monday, October 29, 2012 03:26:20 PM Ralf Mardorf wrote: > On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > > > > wrote: > > > Hi :) > > > > > > how can I get rid of the variable "seconds"? > > > > > > ((seconds=(done-started)-(((done-

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > wrote: > > Hi :) > > > > how can I get rid of the variable "seconds"? > > > > ((seconds=(done-started)-(((done-started)/60)*60)+100)) > > min_sec=$(((done-started)/60))":"${seconds: -2} > >

Re: bash scripting question

2010-03-29 Thread Karl Vogel
Here's something I modified as part of a benchmark script called "fdtree". -- Karl Vogel I don't speak for the USAF or my company Dijkstra probably hates me. --Linus Torvalds, in kernel/sched.c #!/bin/bash # How to use xdate/xtime/persec: # # START=$(date "+%s")

Re: bash scripting question

2010-03-29 Thread Ron Johnson
On 2010-03-29 16:35, Mike McClain wrote: [snip] Thanks a lot. Though my error was pointed out as a typo and corrected a while back your solution using " date '+%s' " is much more elegant than what I had done. If you want more (possibly too much) precision: $ date +'%s.%N' -- "History does not

Re: bash scripting question

2010-03-29 Thread Mike McClain
Hi Josep, On Mon, Mar 29, 2010 at 02:28:20PM +0200, Josep M. wrote: > > I found these somewhere time ago. check if is what You need: > Thanks a lot. Though my error was pointed out as a typo and corrected a while back your solution using " date '+%s' " is much more elegant than what I had don

Re: bash scripting question

2010-03-29 Thread Josep M.
Hello. I found these somewhere time ago. check if is what You need: function timer() { if [[ $# -eq 0 ]]; then echo $(date '+%s') else local stime=$1 etime=$(date '+%s') if [[ -z "$stime" ]]; then stime=$etime; fi dt=$((etime - stime)

Re: bash scripting question

2010-03-19 Thread Chris Jackson
Paul E Condon wrote: Try: bgn=$(date +%s) sleep 7 end=$(date +%s) echo "elapsed seconds = " $(( end - bgn )) You might also want to experiment with: ps h -o etime $$ as long as you're happy with it only running under gnu. Prints the elapsed time for the shell. -- Chris Jackson Shadowcat

Re: bash scripting question

2010-03-19 Thread Paul E Condon
On 20100319_101928, Mike McClain wrote: > I've written a function to print elapsed time similar to /usr/bin/time > but can be called at the beginning and end of a script from within > the script. Occasionally I get an error: '8-08: value too great for base' > It's caused by the difference in these

Re: bash scripting question

2010-03-19 Thread Mike McClain
On Fri, Mar 19, 2010 at 06:45:15PM +0100, Sven Joachim wrote: > On 2010-03-19 18:19 +0100, Mike McClain wrote: > > > I've written a function to print elapsed time similar to /usr/bin/time > > but can be called at the beginning and end of a script from within > > the script. Occasionally I get an e

Re: bash scripting question

2010-03-19 Thread Mike McClain
On Fri, Mar 19, 2010 at 10:19:28AM -0700, Mike McClain wrote: typo right herevv > now='09:07:16'; startHr=${now%%:*}; startHR=${startHr#*0}; echo $startHr; Apologies for troubling all. Mike (with egg on face) -- Satisfied user of Linux since 1997. O< ascii ribbon c

Re: bash scripting question

2010-03-19 Thread Wayne
Mike McClain wrote: I've written a function to print elapsed time similar to /usr/bin/time but can be called at the beginning and end of a script from within the script. Occasionally I get an error: '8-08: value too great for base' It's caused by the difference in these 2 command strings but I ca

Re: bash scripting question

2010-03-19 Thread Chris Jackson
Mike McClain wrote: I've written a function to print elapsed time similar to /usr/bin/time but can be called at the beginning and end of a script from within the script. Occasionally I get an error: '8-08: value too great for base' It's caused by the difference in these 2 command strings but I c

Re: bash scripting question

2010-03-19 Thread S Scharf
On Fri, Mar 19, 2010 at 1:19 PM, Mike McClain wrote: > I've written a function to print elapsed time similar to /usr/bin/time > but can be called at the beginning and end of a script from within > the script. Occasionally I get an error: '8-08: value too great for base' > It's caused by the diffe

Re: bash scripting question

2010-03-19 Thread Sven Joachim
On 2010-03-19 18:19 +0100, Mike McClain wrote: > I've written a function to print elapsed time similar to /usr/bin/time > but can be called at the beginning and end of a script from within > the script. Occasionally I get an error: '8-08: value too great for base' > It's caused by the difference i

bash scripting question

2010-03-19 Thread Mike McClain
I've written a function to print elapsed time similar to /usr/bin/time but can be called at the beginning and end of a script from within the script. Occasionally I get an error: '8-08: value too great for base' It's caused by the difference in these 2 command strings but I can't for the life of m

Re: bash scripting question

2007-05-17 Thread Bob McGowan
Tyler Smith wrote: On 2007-05-17, Bob McGowan <[EMAIL PROTECTED]> wrote: Some general comments, mostly aimed at making your code cleaner without changing what it does. First, both 'echo' and 'printf' put their results on standard out. Your call of 'printf' is inside command substitution, so

Re: bash scripting question

2007-05-16 Thread Alex Samad
On Thu, May 17, 2007 at 03:40:15AM +, Tyler Smith wrote: > On 2007-05-17, Bob McGowan <[EMAIL PROTECTED]> wrote: > > > > Some general comments, mostly aimed at making your code cleaner without > > changing what it does. > > > > First, both 'echo' and 'printf' put their results on standard out.

Re: bash scripting question

2007-05-16 Thread Tyler Smith
On 2007-05-17, Bob McGowan <[EMAIL PROTECTED]> wrote: > > Some general comments, mostly aimed at making your code cleaner without > changing what it does. > > First, both 'echo' and 'printf' put their results on standard out. Your > call of 'printf' is inside command substitution, so its STDOUT

Re: bash scripting question

2007-05-16 Thread Bob McGowan
Tyler Smith wrote: Hi, I've got a question about a short bash script I wrote. I need it to --snipped-- #!/bin/bash lab_num=41 for map_name in aest_90 bush_90 carol_90 comp_90 \ hirs_90 roan_90 swan_90 vir_90 ; do lab_let=$(echo -n $(printf "\\x$(echo $lab_num)")) echo " $la

Re: bash scripting question

2007-05-16 Thread Tyler Smith
On 2007-05-16, Karl E. Jorgensen <[EMAIL PROTECTED]> wrote: >> This was the only way I could figure out to loop from A to H. But >> since it works on hex escape codes, it won't work past 9. Is there a >> cleaner, more general way to do this? > > I think there is: > > #!/bin/bash > > ( cat < A aest_

Re: bash scripting question

2007-05-16 Thread Karl E. Jorgensen
On Wed, May 16, 2007 at 08:46:37PM +, Tyler Smith wrote: > Hi, > > I've got a question about a short bash script I wrote. I need it to > loop over a number of names, and pass a command to grass that includes > two variations of those names. That was easy. Harder was getting > getting a letter

bash scripting question

2007-05-16 Thread Tyler Smith
Hi, I've got a question about a short bash script I wrote. I need it to loop over a number of names, and pass a command to grass that includes two variations of those names. That was easy. Harder was getting getting a letter included in each iteration, starting with A for the first one and going u

Re: bash scripting q

2006-09-29 Thread Kevin Mark
On Fri, Sep 29, 2006 at 08:02:38AM -0500, Hugo Vanwoerkom wrote: > Kevin Mark wrote: > >On Wed, Sep 27, 2006 at 09:22:05PM -0500, Ron Johnson wrote: > >>how about > >> b=`$a` > >> echo $b > > > >or > >echo $($a) > > > Bingo!!! Th

Re: bash scripting q

2006-09-29 Thread Hugo Vanwoerkom
Hugo Vanwoerkom wrote: Hi, On my way to elapsed time in a bash script, I created the do_chrono command. It pumps the elapsed time to stdout. So if I do: a=do_chrono and then: $a I get: 0:3:19. Problem: I can't use that $a anywhere, e.g. if I say: echo $a I would expect to see 0:3:19 ag

Re: bash scripting q

2006-09-29 Thread Hugo Vanwoerkom
Kevin Mark wrote: On Wed, Sep 27, 2006 at 09:22:05PM -0500, Ron Johnson wrote: how about b=`$a` echo $b or echo $($a) Bingo!!! Thanks! Is that in the Advanced Bash-Scripting Guide? H echo `$a` -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubs

Re: bash scripting q

2006-09-29 Thread Hugo Vanwoerkom
Atle Veka wrote: In your example you are saying that $a is the function 'do_chrono', so when you run $a, it runs the function and prints out the result. As another poster indicated, you need to do it slightly differently: # execute and store result in $a a=$( do_chrono ) # print echo $a Yup

Re: bash scripting q

2006-09-29 Thread Hugo Vanwoerkom
Ron Johnson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/27/06 18:51, Hugo Vanwoerkom wrote: Hi, On my way to elapsed time in a bash script, I created the do_chrono command. It pumps the elapsed time to stdout. So if I do: a=do_chrono and then: $a I get: 0:3:19. Problem: I

Re: bash scripting q

2006-09-28 Thread Kevin Mark
On Wed, Sep 27, 2006 at 09:22:05PM -0500, Ron Johnson wrote: > > how about > b=`$a` > echo $b or echo $($a) echo `$a` -- | .''`. == Debian GNU/Linux == | my web site: | | : :' : The Universal | debian.home.pipeline.com | | `. `' Operating System| go to coun

Re: bash scripting q

2006-09-27 Thread Atle Veka
In your example you are saying that $a is the function 'do_chrono', so when you run $a, it runs the function and prints out the result. As another poster indicated, you need to do it slightly differently: # execute and store result in $a a=$( do_chrono ) # print echo $a Atle - Flying Crocodile

Re: bash scripting q

2006-09-27 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/27/06 18:51, Hugo Vanwoerkom wrote: > Hi, > > On my way to elapsed time in a bash script, I created the do_chrono > command. It pumps the elapsed time to stdout. > > So if I do: > > a=do_chrono > > and then: > > $a > > I get: 0:3:19. > > P

bash scripting q

2006-09-27 Thread Hugo Vanwoerkom
Hi, On my way to elapsed time in a bash script, I created the do_chrono command. It pumps the elapsed time to stdout. So if I do: a=do_chrono and then: $a I get: 0:3:19. Problem: I can't use that $a anywhere, e.g. if I say: echo $a I would expect to see 0:3:19 again, but I don't, it say

Re: BASH Scripting Question

2005-11-25 Thread David Kirchner
On 11/25/05, Metrics <[EMAIL PROTECTED]> wrote: > Hi all, > > Can someone explain to me the following behaviour? I have this script > > #!/bin/sh > > LISTS=('debian-user' 'security-basics' 'hostap' 'pen-test' 'ntbugtraq' > 'ion-general' 'vim' 'madwifi'); > LIST_COUNT=${#LISTS} > echo $LIST_COUNT >

BASH Scripting Question

2005-11-25 Thread Metrics
Hi all, Can someone explain to me the following behaviour? I have this script #!/bin/sh LISTS=('debian-user' 'security-basics' 'hostap' 'pen-test' 'ntbugtraq' 'ion-general' 'vim' 'madwifi'); LIST_COUNT=${#LISTS} echo $LIST_COUNT for ((i=0;i<$LIST_COUNT-1;i++)); do echo /home/bhillis/Ma

Any comments on Advance Bash-Scripting Guide?

2004-05-28 Thread Hui Chen
Hi, all What do you think about the abs-guide package in debian distro? How about a `better` book on bash scripting? Hui -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Re: OT: procmail recipe/bash scripting issue

2004-01-29 Thread Kevin Mark
On Mon, Jan 26, 2004 at 12:33:53AM -0500, Matt Price wrote: > hey everyone, > > trying to get procmail to pipe messages to a script I wrote that > processes mail to a web page. Here's the recipe: > --- Hi Matt, did you do any testing? did you create a sam

Re: OT: procmail recipe/bash scripting issue

2004-01-26 Thread Philipp Weis
On 26 Jan 2004, Matt Price <[EMAIL PROTECTED]> wrote: > So I asusme the script is running, but it's not receiving the data it > needs, or at least not understanding it. > > Here's the script, which as ou see is very primitive: > -- > cat /usr/local/scripts/movi

OT: procmail recipe/bash scripting issue

2004-01-25 Thread Matt Price
hey everyone, trying to get procmail to pipe messages to a script I wrote that processes mail to a web page. Here's the recipe: --- :0: * ? $FORMAIL -x From: | grep -isF -f /home/movies/friends_and_family.txt | /usr/local/scripts/moviepage --

Re: OT: bash scripting question -- passing values to ls

2004-01-06 Thread David Z Maze
Matt Price <[EMAIL PROTECTED]> writes: > here's something that ocmes up a lot for me: > > I use locate to find a bunch of files: > > % locate charter | grep -i font > /usr/share/texmf/fonts/afm/bitstrea/charter > /usr/share/texmf/fonts/tfm/bitstrea/charter > /usr/share/texmf/fonts/type1/bitstrea

Re: OT: bash scripting question -- passing values to ls

2004-01-04 Thread Gregory Seidman
On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote: [...] } ls < locate charter | grep -i font } ? } nothing I try works -- but I can't believe it's impossible! any } hints? locate charter | grep -i font | tr '\012' '\000' | xargs -0 ls -ld xargs is your friend. So is tr. Learn them an

Re: OT: bash scripting question -- passing values to ls

2004-01-04 Thread Paul Morgan
On Sat, 03 Jan 2004 23:34:59 -0800, Nano Nano wrote: > On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote: >> so I have to do it by hand at the moment. But shouldn't I be able to >> automate it with somthing like: >> >> ls < locate charter | grep -i font >> ? >> nothing I try works -- b

Re: OT: bash scripting question -- passing values to ls

2004-01-04 Thread Colin Watson
On Sun, Jan 04, 2004 at 03:36:36AM -0500, Kevin Mark wrote: > I use a little bash code over and over again. > Its a while loop. > > locate charter| grep -i font | while read line; do > ls -l $line; > done > > It has many uses and it doesnt have a limit like xargs. > I found out about xargs

Re: OT: bash scripting question -- passing values to ls

2004-01-04 Thread Nano Nano
On Sun, Jan 04, 2004 at 01:10:51AM -0800, Nano Nano wrote: [snip] > it looks messier) and you can't use the sort options of less, for i meant sort options of ls -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Re: OT: bash scripting question -- passing values to ls

2004-01-04 Thread Nano Nano
On Sun, Jan 04, 2004 at 03:36:36AM -0500, Kevin Mark wrote: [snip] > > locate charter| grep -i font | while read line; do > ls -l $line; > done Invoking 'ls' in a loop is semantically different from invoking it once, although you can compensate for it. I prefer backticks because you can

Re: OT: bash scripting question -- passing values to ls

2004-01-04 Thread Kevin Mark
On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote: > hey folks, > > here's something that ocmes up a lot for me: > > I use locate to find a bunch of files: > > % locate charter | grep -i font > /usr/share/texmf/fonts/afm/bitstrea/charter > /usr/share/texmf/fonts/tfm/bitstrea/charter >

Re: OT: bash scripting question -- passing values to ls

2004-01-04 Thread Nano Nano
On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote: > so I have to do it by hand at the moment. But shouldn't I be able to > automate it with somthing like: > > ls < locate charter | grep -i font > ? > nothing I try works -- but I can't believe it's impossible! any > hints? I use back

OT: bash scripting question -- passing values to ls

2004-01-04 Thread Matt Price
hey folks, here's something that ocmes up a lot for me: I use locate to find a bunch of files: % locate charter | grep -i font /usr/share/texmf/fonts/afm/bitstrea/charter /usr/share/texmf/fonts/tfm/bitstrea/charter /usr/share/texmf/fonts/type1/bitstrea/charter /usr/share/texmf/fonts/vf/bitstre

Re: Bash scripting

2003-03-10 Thread Ron Johnson
On Mon, 2003-03-10 at 01:02, Jeff Elkins wrote: > Jeff Elkins <[EMAIL PROTECTED]> writes: > > ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e > > s/arm.*/arm/ -e s/sa110/arm/ > > > > I'm working on polishing my meagre shell scripting skills and would > > appreciate some feedba

Re: Bash scripting

2003-03-09 Thread Jeff Elkins
Jeff Elkins <[EMAIL PROTECTED]> writes: > ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e > s/arm.*/arm/ -e s/sa110/arm/ > > I'm working on polishing my meagre shell scripting skills and would > appreciate some feedback on the line above, quoted from the kernel > Makefile. Th

Re: Bash scripting

2003-03-09 Thread Jereme Corrado
Hi Jeff, Jeff Elkins <[EMAIL PROTECTED]> writes: > ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e > s/arm.*/arm/ -e s/sa110/arm/ > > I'm working on polishing my meagre shell scripting skills and would > appreciate some feedback on the line above, quoted from the ke

Re: Bash scripting

2003-03-09 Thread Bob Proulx
Jeff Elkins wrote: > ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e > s/arm.*/arm/ -e s/sa110/arm/ > > I'm working on polishing my meagre shell scripting skills and would > appreciate some feedback on the line above, quoted from the kernel Makefile. Ew, that line seems to

Re: Bash scripting

2003-03-09 Thread Bob Proulx
David Z Maze wrote: > Two somewhat common ways: > > uname -m | grep i.86 > /dev/null && echo x86 My I suggest using 'grep -q' to save the need to redirect? > case `uname -m` in > i?86) echo x86 ;; > esac I prefer the case statement approach. Bob pgp0.pgp Description: PGP signat

Re: Bash scripting

2003-03-09 Thread David Z Maze
Jeff Elkins <[EMAIL PROTECTED]> writes: > ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e > s/arm.*/arm/ -e s/sa110/arm/ > > I'm working on polishing my meagre shell scripting skills and would > appreciate some feedback on the line above, quoted from the kernel Makefile. > >

Bash scripting

2003-03-09 Thread Jeff Elkins
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ I'm working on polishing my meagre shell scripting skills and would appreciate some feedback on the line above, quoted from the kernel Makefile. 1. How would you use this in a straight bash script

Re: bash scripting question

2002-11-03 Thread Joshua Lee
On Sun, Nov 03, 2002 at 12:28:26PM -0700, Bob Proulx wrote: > get around 40,000 files in one single directory. Some filesystems > such as JFS (and I think, not sure, XFS and ReiserFS too) store > directies in B+ trees and are specifically designed to handle large I know that ReiserFS does this. X

Re: bash scripting question

2002-11-03 Thread Bob Proulx
Neal Lippman <[EMAIL PROTECTED]> [2002-11-03 13:35:22 -0500]: > Thanks. My "bug" here was using comma instead of space as the separator, > and not realizing that the reason for x in {a,b,c,d...z} worked was > because of the way the brace expansion was being done by the shell. Ah, yes, csh style {o

Re: bash scripting question

2002-11-03 Thread Jesus Climent
On Sat, Nov 02, 2002 at 10:51:00PM -0500, Neal Lippman wrote: > > This works fine if I actually type out the entire alphabet list on the > command line as above, but that's sort of a pain. So, I tried setting a > shell variable to the alphabet string (export alpha="A,B,C,...,Z"), but > then the co

Re: bash scripting question

2002-11-03 Thread Bob Proulx
Neal Lippman <[EMAIL PROTECTED]> [2002-11-02 22:51:00 -0500]: > I am trying to solve a bash scripting problem, but I cannot figure it > out. > > I frequently need to execute a command of the form: > for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V

Re: bash scripting question

2002-11-03 Thread Bob Proulx
[EMAIL PROTECTED] <[EMAIL PROTECTED]> [2002-11-03 18:15:06 +0200]: > On Sat, Nov 02, 2002 at 10:05:45PM -0600, Michael Heironimus wrote: > > alpha="a b c d e z" > > for x in $alpha ; do > > echo $x > > done > > > > I think this should work in any Bourne-style shell > > Doesn't wo

Re: bash scripting question

2002-11-03 Thread Bob Proulx
Matthias Hentges <[EMAIL PROTECTED]> [2002-11-03 18:32:29 +0100]: > Am Son, 2002-11-03 um 04.51 schrieb Neal Lippman: > > I frequently need to execute a command of the form: > > for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z); do > Your problem ist the wrong setting of th

Re: bash scripting question

2002-11-03 Thread Matthias Hentges
Am Son, 2002-11-03 um 04.51 schrieb Neal Lippman: > I am trying to solve a bash scripting problem, but I cannot figure it > out. > > I frequently need to execute a command of the form: > for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y

Re: bash scripting question

2002-11-03 Thread shaulka
On Sat, Nov 02, 2002 at 10:05:45PM -0600, Michael Heironimus wrote: > On Sat, Nov 02, 2002 at 10:51:00PM -0500, Neal Lippman wrote: > > shell variable to the alphabet string (export alpha="A,B,C,...,Z"), but > > then the command: > > for x in {$alpha} ; > > do > > echo $x; > >

Re: bash scripting question

2002-11-02 Thread Michael Heironimus
On Sat, Nov 02, 2002 at 10:51:00PM -0500, Neal Lippman wrote: > shell variable to the alphabet string (export alpha="A,B,C,...,Z"), but > then the command: > for x in {$alpha} ; > do > echo $x; > done > winds up printing the string "{A,B,C,...,Z}" rather than each l

bash scripting question

2002-11-02 Thread Neal Lippman
I am trying to solve a bash scripting problem, but I cannot figure it out. I frequently need to execute a command of the form: for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z); do ; done This works fine if I actually type out the entire

Thank you all! (Was: Re: bash scripting question (variables and spaces))

2002-03-20 Thread Karsten Heymann
Thank you all! Now it works. * Gustavo Noronha Silva <[EMAIL PROTECTED]> [020320 09:25]: ... > C="$A $B" -- Karsten Heymann <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> CAU-University Kiel, Germany Registered Linux User #221014 (http://counter.li.org)

Re: bash scripting question (variables and spaces)

2002-03-19 Thread Brett Parker
On Tue, Mar 19, 2002 at 08:35:53PM +0100, Karsten Heymann wrote: > Hi, > > I have once again come upon bash problem I can't solve. I'm writing a > little bash frontend and one of the programs expects a option that includes > spaces and is composed from two other shell var's. Example: > > #!/bin/b

Re: bash scripting question (variables and spaces)

2002-03-19 Thread Angus D Madden
Karsten Heymann, Tue, Mar 19, 2002 at 08:35:53PM +0100: > Hi, > > I have once again come upon bash problem I can't solve. I'm writing a > little bash frontend and one of the programs expects a option that includes > spaces and is composed from two other shell var's. Example: > > #!/bin/bash > A=

Re: bash scripting question (variables and spaces)

2002-03-19 Thread Gustavo Noronha Silva
On Tue, 19 Mar 2002 20:35:53 +0100 Karsten Heymann <[EMAIL PROTECTED]> wrote: > Hi, > > I have once again come upon bash problem I can't solve. I'm writing a > little bash frontend and one of the programs expects a option that includes > spaces and is composed from two other shell var's. Example:

Re: bash scripting question (variables and spaces)

2002-03-19 Thread David Z Maze
Karsten Heymann <[EMAIL PROTECTED]> writes: > Hi, > > I have once again come upon bash problem I can't solve. I'm writing > a little bash frontend and one of the programs expects a option that > includes spaces and is composed from two other shell var's. Example: > > #!/bin/bash > A="Hello" > B="

Re: bash scripting question (variables and spaces)

2002-03-19 Thread Paul F. Pearson
B" > C='$A $B' > C=$A\ $B > C=`echo $A $B` > > What works is > someprog --greeting "Hello Karsten" > but that's no solution. try someprot --greeting "$A $B" There's an excelleng bash scripting HOWTO (don't know the URL right of t

Re: bash scripting question (variables and spaces)

2002-03-19 Thread J.H.M. Dassen \(Ray\)
On Tue, Mar 19, 2002 at 20:35:53 +0100, Karsten Heymann wrote: > A="Hello" > B="Karsten" > C=$A $B > someprog --greeting $C Variable expansion happens first: someprog --greeting Hello Karsten then tokenising, so someprog get three arguments: 1. --greeting 2. Hello

Re: bash scripting question (variables and spaces)

2002-03-19 Thread ktb
On Tue, Mar 19, 2002 at 08:35:53PM +0100, Karsten Heymann wrote: > Hi, > > I have once again come upon bash problem I can't solve. I'm writing a > little bash frontend and one of the programs expects a option that includes > spaces and is composed from two other shell var's. Example: > > #!/bin/b

Re: bash scripting question (variables and spaces)

2002-03-19 Thread Craig Dickson
This should work, though I have not actually tried it: #!/bin/bash A="Hello" B="Karsten" C="$A $B" someprog --greeting "$C" pgpiX8Z2JqpWm.pgp Description: PGP signature

bash scripting question (variables and spaces)

2002-03-19 Thread Karsten Heymann
Hi, I have once again come upon bash problem I can't solve. I'm writing a little bash frontend and one of the programs expects a option that includes spaces and is composed from two other shell var's. Example: #!/bin/bash A="Hello" B="Karsten" C=$A $B someprog --greeting $C Whatever I do now, -

Re: Bash Scripting

2001-01-31 Thread John Hasler
D-Man writes: > If he wants to start with bash he can. I think bash scripting is harder > than python though. Poor shell programming is quite easy. Good shell progamming is harder than good Python programming. -- John Hasler [EMAIL PROTECTED] Dancing Horse Hill Elmwood, Wisconsin

Re: Bash Scripting

2001-01-31 Thread D-Man
On Tue, Jan 30, 2001 at 10:55:53PM +0100, William Leese wrote: [snip] | > BTW, I don't use bash scripting for anything other than running | > programs with some default options. I would prefer to use python for | > this sort of thing, but it's up to you what you want to

Re: Bash Scripting

2001-01-30 Thread Nate Bargmann
On Tue, Jan 30, 2001 at 09:40:53PM +0100, William Leese wrote: > hi all > > i need a little help on a script. the following scripts function is to merge > several parts of a html page together and insert a new piece of text from > text.txt also it has to replace some words (the title, author, su

Re: Bash Scripting

2001-01-30 Thread Oliver Elphick
D-Man wrote: >sed "s/Title/$TITLE/g" title.html >> file.txt && > >Also, I'm not sure why you have double & at the end of the line. I >think you want to run sed in the foreground, not the background. I >don't understand what the second & does. & by itself mean s to run in the backgr

Re: Bash Scripting

2001-01-30 Thread William Leese
, ofcourse.. > | I think the g is missing, that is all I noticed > > You only need the g if the text to replace occurs more than once on a > line. If it doesn't, it doesn't matter. If it does, do you want to > replace all occurences or just the first? its just a one

RE: Bash Scripting

2001-01-30 Thread Sean 'Shaleh' Perry
On 30-Jan-2001 William Leese wrote: > hi all > > i need a little help on a script. the following scripts function is to merge > several parts of a html page together and insert a new piece of text from > text.txt also it has to replace some words (the title, author, submittor, and > date) with

Re: Bash Scripting

2001-01-30 Thread D-Man
and what the second & does. | I think the g is missing, that is all I noticed You only need the g if the text to replace occurs more than once on a line. If it doesn't, it doesn't matter. If it does, do you want to replace all occurences or just the first? | | Ciao, mattHias | |

Re: Bash Scripting

2001-01-30 Thread Matthias Wieser
William Leese wrote: > sed 's/Title/$TITLE/g' title.html >> file.txt && ^ I think the g is missing, that is all I noticed Ciao, mattHias -- __ _ __ * /\_/\ \ \_/ \_/ / * Matthias Wieser * / \ \ /

Bash Scripting

2001-01-30 Thread William Leese
hi all i need a little help on a script. the following scripts function is to merge several parts of a html page together and insert a new piece of text from text.txt also it has to replace some words (the title, author, submittor, and date) with the words given at prompt. - #!/bin/bas

RE: Bash scripting problem

2000-05-02 Thread Christophe ABRIAL
etc/modules.conf echo "DEBUG3: found_driver=$found_driver" Hope it's help! Christophe Abrial LSA France Systems and Networks Solutions -Message d'origine- De : Martin Fluch [mailto:[EMAIL PROTECTED] Envoye : mardi 2 mai 2000 09:43 A : debian-user@lists.debian.org Ob

Bash scripting problem

2000-05-02 Thread Martin Fluch
Hi all! On my woody box I ran into the following problem: After I had problem with the /etc/init.d/alsa script I started to track down the problem and finaly ended with the following script, which doesn't work like I expect: #!/bin/bash -e found_driver=0 echo -n "Starting sound dri

FW: bash scripting

1999-07-26 Thread JARDINE, Jeff
> -Original Message- > From: Michael Talbot-Wilson [SMTP:[EMAIL PROTECTED] > Sent: Monday, July 26, 1999 4:54 AM > To: Ben Lutgens > Cc: debian user list > Subject: Re: bash scripting > > It is bad netiquette to paste part of the man page, becau

  1   2   >