Re: Re: bash Shell Scripting Question

2012-09-20 Thread Jan Henrik Sylvester
On 09/20/2012 04:29, Polytropon wrote: Correct. You could use different approaches which may or may not fail due to the directory names you will encounter (like directories with spaces or special characters). #!/bin/sh for DIR in `ls -LF | grep \/`; do cd ${DIR}

Re: bash Shell Scripting Question

2012-09-20 Thread Martin McCormick
Many thanks! The for loop was what was needed. Polytropon writes: Just a sidenote: If you're not using bash-specific functionality and intend to make your script portable, use #!/bin/sh instead. I always start out that way for that very reason. I needed some random number functions and

Re: bash Shell Scripting Question

2012-09-20 Thread Polytropon
On Thu, 20 Sep 2012 11:16:40 +0200, Jan Henrik Sylvester wrote: On 09/20/2012 04:29, Polytropon wrote: Correct. You could use different approaches which may or may not fail due to the directory names you will encounter (like directories with spaces or special characters). #!/bin/sh

bash Shell Scripting Question

2012-09-19 Thread Martin McCormick
I just discovered a knowledge deficiency on my part that I can't seem to resolve. If one writes a loop of the following form: #!/usr/local/bin/bash ls -LF |grep \/ /tmp/files while read dirname; do cd $dirname #Do whatever commands to be repeated in each directory. done

Re: bash Shell Scripting Question

2012-09-19 Thread Mihai Donțu
On Wed, 19 Sep 2012 21:03:11 -0500 Martin McCormick wrote: #!/usr/local/bin/bash ls -LF |grep \/ /tmp/files while read dirname; do cd $dirname #Do whatever commands to be repeated in each directory. done /tmp/files How about: ls -LF | grep \/ | while read dirname; do cd $dirname

Re: bash Shell Scripting Question

2012-09-19 Thread Polytropon
On Wed, 19 Sep 2012 21:03:11 -0500, Martin McCormick wrote: I just discovered a knowledge deficiency on my part that I can't seem to resolve. If one writes a loop of the following form: #!/usr/local/bin/bash Just a sidenote: If you're not using bash-specific functionality and

A bash scripting question

2012-06-21 Thread Odhiambo Washington
How Can I simplify/perfect the following script, so that I read _ALL_ the lines in the file and act on the content as shown below, so that I do not have to specifiy an action per line? This below is doing exactly what i need BUT reading one line at a time untill the 10th line, if i want more i

Re: A bash scripting question

2012-06-21 Thread Devin Teske
On Jun 21, 2012, at 6:40 AM, Odhiambo Washington wrote: How Can I simplify/perfect the following script, so that I read _ALL_ the lines in the file and act on the content as shown below, so that I do not have to specifiy an action per line? This below is doing exactly what i need BUT

Re: A bash scripting question

2012-06-21 Thread CyberLeo Kitsana
On 06/21/2012 08:40 AM, Odhiambo Washington wrote: How Can I simplify/perfect the following script, so that I read _ALL_ the lines in the file and act on the content as shown below, so that I do not have to specifiy an action per line? This below is doing exactly what i need BUT reading one

Re: A bash scripting question

2012-06-21 Thread Julian H. Stacey
CyberLeo Kitsana wrote Odhiambo Washington: By the way, what's gammu, /usr/ports/comms/gammu presumably ( for mobile phone connection ) and why is it in /usr/bin ? Pass. Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Reply below not above,

RE: A bash scripting question

2012-06-21 Thread dteske
-Original Message- From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd- questi...@freebsd.org] On Behalf Of Devin Teske Sent: Thursday, June 21, 2012 9:24 AM To: Odhiambo Washington Cc: questions Subject: Re: A bash scripting question On Jun 21, 2012, at 6:40 AM

RE: A bash scripting question

2012-06-21 Thread dteske
-Original Message- From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd- questi...@freebsd.org] On Behalf Of dte...@freebsd.org Sent: Thursday, June 21, 2012 12:57 PM To: 'Odhiambo Washington' Cc: 'questions' Subject: RE: A bash scripting question -Original

Re: randomising tracks: scripting question

2011-01-04 Thread Peter Vereshagin
You know St. Peter won't call my name, freebsd-questions! 2011/01/03 20:23:38 -0800 Joseph Olatt j...@eskimo.com = To Frank Shute : JO On Sun, Dec 26, 2010 at 05:09:30PM +, Frank Shute wrote: JO JO I generally play my tracks of an album like so: JO JO for track in $(cat

Re: randomising tracks: scripting question

2011-01-03 Thread Joseph Olatt
On Sun, Dec 26, 2010 at 05:09:30PM +, Frank Shute wrote: I generally play my tracks of an album like so: for track in $(cat trombone_shorty-backatown.m3u); do mplayer $track done They then play in the correct order. How would I go about randomising the order of play using sh

randomising tracks: scripting question

2010-12-26 Thread Frank Shute
I generally play my tracks of an album like so: for track in $(cat trombone_shorty-backatown.m3u); do mplayer $track done They then play in the correct order. How would I go about randomising the order of play using sh (preferably) or perl? Sorry for the OT posting but I thought a brainteaser

Re: randomising tracks: scripting question

2010-12-26 Thread Chip Camden
Quoth Frank Shute on Sunday, 26 December 2010: I generally play my tracks of an album like so: for track in $(cat trombone_shorty-backatown.m3u); do mplayer $track done They then play in the correct order. How would I go about randomising the order of play using sh (preferably) or

Re: randomising tracks: scripting question

2010-12-26 Thread RW
On Sun, 26 Dec 2010 09:40:43 -0800 Chip Camden sterl...@camdensoftware.com wrote: Quoth Frank Shute on Sunday, 26 December 2010: I generally play my tracks of an album like so: for track in $(cat trombone_shorty-backatown.m3u); do mplayer $track done They then play in the correct

Re: randomising tracks: scripting question

2010-12-26 Thread Mark Caudill
How would I go about randomising the order of play using sh (preferably) or perl? I fiddled around for a minute without luck but I think between the built-in $RANDOM, tail and head you should be able to get a randomize going. I'd recommend putting a script together that just pulls a random

Re: randomising tracks: scripting question

2010-12-26 Thread Frank Shute
On Sun, Dec 26, 2010 at 06:01:45PM +, RW wrote: On Sun, 26 Dec 2010 09:40:43 -0800 Chip Camden sterl...@camdensoftware.com wrote: Quoth Frank Shute on Sunday, 26 December 2010: I generally play my tracks of an album like so: for track in $(cat trombone_shorty-backatown.m3u);

Re: randomising tracks: scripting question

2010-12-26 Thread b. f.
Frank Shute wrote: I generally play my tracks of an album like so: for track in $(cat trombone_shorty-backatown.m3u); do mplayer $track done They then play in the correct order. How would I go about randomising the order of play using sh (preferably) or perl? cat trombone_shorty-backatown.m3u

Re: randomising tracks: scripting question

2010-12-26 Thread Chris Brennan
On Sun, Dec 26, 2010 at 2:04 PM, b. f. bf1...@googlemail.com wrote: Frank Shute wrote: I generally play my tracks of an album like so: for track in $(cat trombone_shorty-backatown.m3u); do mplayer $track done They then play in the correct order. How would I go about randomising the

Re: randomising tracks: scripting question

2010-12-26 Thread Devin Teske
On Dec 26, 2010, at 11:02 AM, Frank Shute wrote: On Sun, Dec 26, 2010 at 06:01:45PM +, RW wrote: On Sun, 26 Dec 2010 09:40:43 -0800 Chip Camden sterl...@camdensoftware.com wrote: Quoth Frank Shute on Sunday, 26 December 2010: I generally play my tracks of an album like so: for

Re: simple (and stupid) shell scripting question

2010-02-16 Thread Christian Weisgerber
Nerius Landys nlan...@gmail.com wrote: Is there a function, or command line utility, to escape a string, making it suitable to be input on the command line? For example, this escape utility would take a input of te st and create an output of te\ st. Other things such as quotes and single

Re: simple (and stupid) shell scripting question

2010-02-15 Thread Eray Aslan
On 15.02.2010 09:21, Nerius Landys wrote: But in the case where you're assigning the output of ls directly to a variable like this: FOO=`ls` vs FOO=`ls` the text assigned to FOO is the same, right? Apparently, it is: sh-4.0$ touch x * sh-4.0$ FOO=`ls`;echo $FOO|od 000 020170

Re: simple (and stupid) shell scripting question

2010-02-15 Thread Christian Weisgerber
Nerius Landys nlan...@gmail.com wrote: #!/bin/sh DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` What if I got rid of extra double quotes? Like this: DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` That is perfectly fine. Word-splitting and filename expansion are not

Re: simple (and stupid) shell scripting question

2010-02-15 Thread Nerius Landys
#!/bin/sh DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` What if I got rid of extra double quotes?  Like this: DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` That is perfectly fine.  Word-splitting and filename expansion are not performed for variable assignments.  Also

simple (and stupid) shell scripting question

2010-02-14 Thread Nerius Landys
#!/bin/sh I have these lines in my script: DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` What if I got rid of extra double quotes? Like this: DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` Does this behave any differently in any kind of case? Are thes double quotes just

Re: simple (and stupid) shell scripting question

2010-02-14 Thread Eray Aslan
On 15.02.2010 08:07, Nerius Landys wrote: DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` What if I got rid of extra double quotes? Like this: DIRNAME=`dirname \$0\` cd $DIRNAME SCRIPTDIR=`pwd` Does this behave any differently in any kind of case? Are thes double quotes just

Re: simple (and stupid) shell scripting question

2010-02-14 Thread Nerius Landys
From the man page: Command Substitution [...]  If  the  substitution  appears within double quotes, word splitting and       pathname expansion are not performed on the results. In other words: sh-4.0$ touch x y sh-4.0$ for i in `ls`; do echo $i; done x y sh-4.0$ for i in `ls`; do

Re: Shell scripting question - incrementing

2008-02-19 Thread Dominic Fandrey
Paul Schmehl wrote: I could do this in perl easily, but I'm trying to force myself to learn shell scripting better. :-) ... Once this file is created (or ideally *while* it's being created!) I need to increment the sid numbers. The first one is 201. The second needs to be 202,

Shell scripting question - incrementing

2008-02-19 Thread Paul Schmehl
I could do this in perl easily, but I'm trying to force myself to learn shell scripting better. :-) I'm parsing a file to extract some elements from it, then writing the results, embeded in long strings, into an output file. Here's the script: cat file.1 | cut -d',' -f9 | sort | uniq

Re: Shell scripting question - incrementing

2008-02-19 Thread Derek Ragona
At 11:35 AM 2/19/2008, Paul Schmehl wrote: I could do this in perl easily, but I'm trying to force myself to learn shell scripting better. :-) I'm parsing a file to extract some elements from it, then writing the results, embeded in long strings, into an output file. Here's the script:

Re: Shell scripting question - incrementing

2008-02-19 Thread Pietro Cerutti
Paul Schmehl wrote: I could do this in perl easily, but I'm trying to force myself to learn shell scripting better. :-) I'm parsing a file to extract some elements from it, then writing the results, embeded in long strings, into an output file. Here's the script: cat file.1 | cut

Re: Shell scripting question - incrementing

2008-02-19 Thread Paul Schmehl
--On Tuesday, February 19, 2008 12:41:43 -0600 Derek Ragona [EMAIL PROTECTED] wrote: Thanks to all who offered suggestions. Here's a working script that creates snort rules *and* a sid-msg.map file: #!/bin/sh cat file.1 | cut -d',' -f9 | sort | uniq file.nicks i=202 j=`wc -l

Re: Scripting question

2007-09-14 Thread Jonathan McKeown
On Thursday 13 September 2007 20:35, Roland Smith wrote: On Thu, Sep 13, 2007 at 10:16:40AM -0700, Kurt Buff wrote: I'm trying to do some text file manipulation, and it's driving me nuts. [snip] I've looked at sort and uniq, and I've googled a fair bit but can't seem to find anything that

Re: Scripting question

2007-09-14 Thread Steve Bertrand
I don't have the perl skills, though that would be ideal. -- snip -- Another approach in Perl would be: #!/usr/bin/perl my (%names, %dups); while () { my ($key) = split; $dups{$key} = 1 if $names{$key}; $names{$key} = 1; } delete @names{keys %dups}; # # keys %names is

Re: Scripting question

2007-09-14 Thread Jonathan McKeown
On Friday 14 September 2007 09:42, Steve Bertrand wrote: I don't have the perl skills, though that would be ideal. -- snip -- Another approach in Perl would be: #!/usr/bin/perl my (%names, %dups); while () { my ($key) = split; $dups{$key} = 1 if $names{$key};

Scripting question

2007-09-13 Thread Kurt Buff
I'm trying to do some text file manipulation, and it's driving me nuts. I've got a sorted file of SMTP addresses, and want to eliminate the lines that are the same up to a space character within the line. Example: [EMAIL PROTECTED] NO [EMAIL PROTECTED] OK The above lines *both* need to be

Re: Scripting question

2007-09-13 Thread Jerry McAllister
On Thu, Sep 13, 2007 at 10:16:40AM -0700, Kurt Buff wrote: I'm trying to do some text file manipulation, and it's driving me nuts. I've got a sorted file of SMTP addresses, and want to eliminate the lines that are the same up to a space character within the line. Example: [EMAIL

Re: Scripting question

2007-09-13 Thread Jerry McAllister
First, please always make sure your responses go to the list. It is both list etiquette and of practical value. Follow-ups to only an individual may not reach the person who can provide real help. Most Email clients have a group reply which will do the trick. On Thu, Sep 13, 2007 at 10:32:34AM

Re: Scripting question

2007-09-13 Thread Kurt Buff
On 9/13/07, Jerry McAllister [EMAIL PROTECTED] wrote: The only space is the one separating the SMTP address from the OK or NO. Then you should be able to tell it to sort on the first token in the string with white space as a separator and to eliminate duplicates. It has been a long time

Re: Scripting question

2007-09-13 Thread Kurt Buff
On 9/13/07, Jerry McAllister [EMAIL PROTECTED] wrote: First, please always make sure your responses go to the list. It is both list etiquette and of practical value. Follow-ups to only an individual may not reach the person who can provide real help. Most Email clients have a group reply

Re: Scripting question

2007-09-13 Thread Roland Smith
On Thu, Sep 13, 2007 at 10:16:40AM -0700, Kurt Buff wrote: I'm trying to do some text file manipulation, and it's driving me nuts. I've got a sorted file of SMTP addresses, and want to eliminate the lines that are the same up to a space character within the line. Example: [EMAIL

Re: Scripting question

2007-09-13 Thread Jeffrey Goldberg
On Sep 13, 2007, at 1:19 PM, Kurt Buff wrote: I think I may have a better solution. The file I'm trying to massage has a predecessor - the non-unique lines are the result of a concatenation of two files. Silly me, it's better to 'grep -v' with the one file vs. the second rather than trying to

Re: Scripting question

2007-09-13 Thread Craig Whipp
On 9/13/07, Jerry McAllister [EMAIL PROTECTED] wrote: The only space is the one separating the SMTP address from the OK or NO. Then you should be able to tell it to sort on the first token in the string with white space as a separator and to eliminate duplicates. It has been a long time

Re: Scripting question

2007-09-13 Thread Kurt Buff
On 9/13/07, Roland Smith [EMAIL PROTECTED] wrote: On Thu, Sep 13, 2007 at 10:16:40AM -0700, Kurt Buff wrote: I'm trying to do some text file manipulation, and it's driving me nuts. I've got a sorted file of SMTP addresses, and want to eliminate the lines that are the same up to a space

Re: Scripting question

2007-09-13 Thread Kurt Buff
On 9/13/07, Craig Whipp [EMAIL PROTECTED] wrote: On 9/13/07, Jerry McAllister [EMAIL PROTECTED] wrote: The only space is the one separating the SMTP address from the OK or NO. Then you should be able to tell it to sort on the first token in the string with white space as a separator

Re: Scripting question

2007-09-13 Thread Kurt Buff
On 9/13/07, Jeffrey Goldberg [EMAIL PROTECTED] wrote: On Sep 13, 2007, at 1:19 PM, Kurt Buff wrote: I think I may have a better solution. The file I'm trying to massage has a predecessor - the non-unique lines are the result of a concatenation of two files. Silly me, it's better to

Re: Scripting question

2007-09-13 Thread Jeffrey Goldberg
On Sep 13, 2007, at 2:38 PM, Kurt Buff wrote: Instead of grep -v take a look at comm. Interesting! I just looked at the man page, and while I don't think it it's going to be directly useful (or I'm just not reading the page correctly), it's a new utility to me - I'll keep it in mind for

Re: Scripting question

2007-09-13 Thread Jonathan McKeown
On Thursday 13 September 2007 20:19, Kurt Buff wrote: On 9/13/07, Jerry McAllister [EMAIL PROTECTED] wrote: The only space is the one separating the SMTP address from the OK or NO. Then you should be able to tell it to sort on the first token in the string with white space as a

RE: Scripting question

2007-09-13 Thread David Christensen
Kurt Buff wrote: I'm trying to do some text file manipulation, and it's driving me nuts. ... I don't have the perl skills, though that would be ideal. Any help out there? Buy Learning Perl, Fourth Edition, read it, and do the exercises:

Re: mysqldump/gzip shell scripting question...

2007-08-17 Thread Alex Zbyslaw
Eric Crist wrote: First off, I don't care if you send example in perl, php, or sh, but we're not a python shop here, so those recommendation will not be useful... I'm trying to write a shell script that scans our databases for tables starting with archive_ which are created by other

mysqldump/gzip shell scripting question...

2007-08-16 Thread Eric Crist
Hey all, First off, I don't care if you send example in perl, php, or sh, but we're not a python shop here, so those recommendation will not be useful... I'm trying to write a shell script that scans our databases for tables starting with archive_ which are created by other scripts/

Re: mysqldump/gzip shell scripting question...

2007-08-16 Thread Garrett Cooper
Eric Crist wrote: Hey all, First off, I don't care if you send example in perl, php, or sh, but we're not a python shop here, so those recommendation will not be useful... I'm trying to write a shell script that scans our databases for tables starting with archive_ which are created by

stupid scripting question: zsh

2007-01-29 Thread David Benfell
Hello all, I've been upgrading my FreeBSD system into a fully-fledged desktop system. zsh as installed (from the port) seems only to recognize the /etc/zshenv startup file. And I needed an stty command to get proper backspace/delete behavior. Because only the /etc/zshenv file seemed to be

Re: stupid scripting question: zsh

2007-01-29 Thread Derek Ragona
The problem is likely the that you don't have the full path to stty in your script, and the automated jobs don't have a proper path set yet. Use the full pathname in your script and see if that works. -Derek At 04:37 PM 1/29/2007, David Benfell wrote: Hello all, I've been

Re: stupid scripting question: zsh

2007-01-29 Thread Dan Nelson
In the last episode (Jan 29), David Benfell said: I've been upgrading my FreeBSD system into a fully-fledged desktop system. zsh as installed (from the port) seems only to recognize the /etc/zshenv startup file. And I needed an stty command to get proper backspace/delete behavior. Because

Re: stupid scripting question: zsh

2007-01-29 Thread David Benfell
On Mon, 29 Jan 2007 17:19:40 -0600, Dan Nelson wrote: In the last episode (Jan 29), David Benfell said: I've been upgrading my FreeBSD system into a fully-fledged desktop system. zsh as installed (from the port) seems only to recognize the /etc/zshenv startup file. And I needed an

Re: stupid scripting question: zsh

2007-01-29 Thread Dan Nelson
In the last episode (Jan 29), David Benfell said: On Mon, 29 Jan 2007 17:19:40 -0600, Dan Nelson wrote: In the last episode (Jan 29), David Benfell said: I've been upgrading my FreeBSD system into a fully-fledged desktop system. zsh as installed (from the port) seems only to

OT: stupid sh scripting question

2007-01-03 Thread Robert Huff
This is probably staring me in the face: if [ ! -d foo] then mkdir foo fi gives me: [: missing ] Looking at rc.subr I see: if [ ! -d $linkdir ]; then warn $_me: the directory $linkdir does not exist. return 1 fi

Re: OT: stupid sh scripting question

2007-01-03 Thread Bill Moran
In response to Robert Huff [EMAIL PROTECTED]: This is probably staring me in the face: if [ ! -d foo] then mkdir foo fi gives me: [: missing ] Looking at rc.subr I see: if [ ! -d $linkdir ]; then warn $_me: the directory $linkdir does not

Re: OT: stupid sh scripting question

2007-01-03 Thread Chuck Swiger
On Jan 3, 2007, at 3:07 PM, Robert Huff wrote: if [ ! -d foo] then mkdir foo fi You want a space before the ] and a semicolon after it. -- -Chuck ___ freebsd-questions@freebsd.org mailing list

Re: OT: stupid sh scripting question

2007-01-03 Thread Kevin Downey
On 1/3/07, Bill Moran [EMAIL PROTECTED] wrote: In response to Robert Huff [EMAIL PROTECTED]: This is probably staring me in the face: if [ ! -d foo] then mkdir foo fi gives me: [: missing ] Looking at rc.subr I see: if [ ! -d $linkdir ]; then

Re: OT: stupid sh scripting question

2007-01-03 Thread Dan Nelson
In the last episode (Jan 03), Robert Huff said: This is probably staring me in the face: if [ ! -d foo] then mkdir foo fi gives me: [: missing ] Looking at rc.subr I see: if [ ! -d $linkdir ]; then warn $_me: the directory $linkdir does not

Re: OT: stupid sh scripting question

2007-01-03 Thread Jerry McAllister
On Wed, Jan 03, 2007 at 03:07:43PM -0500, Robert Huff wrote: This is probably staring me in the face: if [ ! -d foo] then mkdir foo fi gives me: [: missing ] It is probably not telling you ':' missing but ';' missing. It goes after the ']', plus I think the space

Re: OT: stupid sh scripting question

2007-01-03 Thread Kevin Downey
On 1/3/07, Jerry McAllister [EMAIL PROTECTED] wrote: On Wed, Jan 03, 2007 at 03:07:43PM -0500, Robert Huff wrote: This is probably staring me in the face: if [ ! -d foo] then mkdir foo fi gives me: [: missing ] It is probably not telling you ':' missing but ';'

Re: OT: stupid sh scripting question

2007-01-03 Thread Matthew Seaman
Robert Huff wrote: This is probably staring me in the face: if [ ! -d foo] Missing space ^ here. ie: if [ ! -d foo ] then mkdir foo fi or perhaps more succinctly: [ -d foo ] || mkdir foo or best of all, maybe just: mkdir -p foo Cheers,

Re: OT: stupid sh scripting question

2007-01-03 Thread Garrett Cooper
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kevin Downey wrote: On 1/3/07, Jerry McAllister [EMAIL PROTECTED] wrote: On Wed, Jan 03, 2007 at 03:07:43PM -0500, Robert Huff wrote: This is probably staring me in the face: if [ ! -d foo] then mkdir foo fi gives

Re: scripting question

2006-10-03 Thread Ivan Levchenko
(forgot to cc the list =)) Remove the word root from the crontab entry. The user should be specified only in the system crontab. On 10/3/06, jan gestre [EMAIL PROTECTED] wrote: i made a script and put on root's crontab, however it's not doing or showing the output that is forwarded to my email

Re: scripting question

2006-10-03 Thread jan gestre
On 10/3/06, Ivan Levchenko [EMAIL PROTECTED] wrote: Remove the word root from the crontab entry. The user should be specified only in the system crontab. thanks ivan, but the solution i made was i put in the /usr/local/etc/periodic/daily directory, it is now working :D On 10/3/06, jan

scripting question

2006-10-02 Thread jan gestre
i made a script and put on root's crontab, however it's not doing or showing the output that is forwarded to my email address correctly therefore i'm not sure if it is working or not. below is what the script look like: # # cvsrun - Weekly CVSup Run echo Subject: `hostname`

Re: scripting question

2006-10-02 Thread Atom Powers
On 10/2/06, jan gestre [EMAIL PROTECTED] wrote: i made a script and put on root's crontab, however it's not doing or showing the output that is forwarded to my email address correctly therefore i'm not sure if it is working or not. below is what the script look like: ... 30 8 * * * root

Re: Shell scripting question [newby]

2006-04-10 Thread Jan Grant
On Mon, 10 Apr 2006, Malcolm Fitzgerald wrote: On 10/04/2006, at 12:39 AM, Jan Grant wrote: On Sun, 9 Apr 2006, Malcolm Fitzgerald wrote: I'm trying to follow the instructions at http://www.daemonology.net/freebsd-upgrade-5.4-to-6.0/ Your advice got me to step 7 where the need

Shell scripting question [newby]

2006-04-09 Thread Malcolm Fitzgerald
I'm trying to follow the instructions at http://www.daemonology.net/freebsd-upgrade-5.4-to-6.0/ At point four it offers this shell script. cut -f 1 -d '$' /usr/local/freebsd-update/work/md5all | uniq | while read X; do if [ -f $X ]; then echo $X; fi; done | sort

Re: Shell scripting question [newby]

2006-04-09 Thread Daniel A.
On 4/9/06, Malcolm Fitzgerald [EMAIL PROTECTED] wrote: I'm trying to follow the instructions at http://www.daemonology.net/freebsd-upgrade-5.4-to-6.0/ At point four it offers this shell script. cut -f 1 -d '$' /usr/local/freebsd-update/work/md5all | uniq | while read X; do

Re: Shell scripting question [newby]

2006-04-09 Thread Jan Grant
On Sun, 9 Apr 2006, Malcolm Fitzgerald wrote: I'm trying to follow the instructions at http://www.daemonology.net/freebsd-upgrade-5.4-to-6.0/ At point four it offers this shell script. cut -f 1 -d '$' /usr/local/freebsd-update/work/md5all | uniq | while read X; do

Re: Shell scripting question [newby]

2006-04-09 Thread Malcolm Fitzgerald
On 10/04/2006, at 12:39 AM, Jan Grant wrote: On Sun, 9 Apr 2006, Malcolm Fitzgerald wrote: I'm trying to follow the instructions at http://www.daemonology.net/freebsd-upgrade-5.4-to-6.0/ At point four it offers this shell script. cut -f 1 -d '$' /usr/local/freebsd-update/work/md5all | uniq

Re: Shell scripting question [newby]

2006-04-09 Thread Malcolm Fitzgerald
On 10/04/2006, at 12:39 AM, Jan Grant wrote: On Sun, 9 Apr 2006, Malcolm Fitzgerald wrote: I'm trying to follow the instructions at http://www.daemonology.net/freebsd-upgrade-5.4-to-6.0/ At point four it offers this shell script. cut -f 1 -d '$' /usr/local/freebsd-update/work/md5all | uniq

Shell scripting question

2006-03-24 Thread Paul Schmehl
I'm thinking about writing an rc.subr script that sucks in variables from a conf file. Since the rc.firewall script does just that, I thought I'd take a look at it. But I can't understand what it's doing. Here's the code: # Suck in the configuration variables. if [ -z

Re: Shell scripting question

2006-03-24 Thread Charles Swiger
On Mar 24, 2006, at 12:12 PM, Paul Schmehl wrote: Neither rc.conf nor source_rc_confs appears anywhere else in the script, so how does this suck in the variables? And what does the syntax . /etc/rc.conf do? Your second question is the answer to your first question: . /etc/rc.conf

Re: shell scripting question (mdconfig device choosing)

2006-01-25 Thread Luke Bakken
Yeah, but I am looking for 0 ... 8,9,11,14 are all in use ... but 0-7 are not. I want to: starting with zero, find the lowest number that is NOT in this list (where this list is the output of mdconfig -l, which shows which md devices are currently in use) Running mdconfig

Re: shell scripting question (mdconfig device choosing)

2006-01-25 Thread Ensel Sharon
On Wed, 25 Jan 2006, Luke Bakken wrote: Thank you very much - you got no output because you have no md devices in use. I have a few in use and this is the output I get: # mdconfig -l md3 md2 md1 md0 But I could just as easily get: # mdconfig -l md9 md8 md5 md3 Hmm...I

Re: shell scripting question (mdconfig device choosing)

2006-01-25 Thread Luke Bakken
Thank you very much - you got no output because you have no md devices in use. I have a few in use and this is the output I get: # mdconfig -l md3 md2 md1 md0 But I could just as easily get: # mdconfig -l md9 md8 md5 md3 Hmm...I just saw that that line is in

Re: shell scripting question (mdconfig device choosing)

2006-01-25 Thread Ensel Sharon
On Wed, 25 Jan 2006, Luke Bakken wrote: #!/bin/sh function find_first_mdevice { MDDEV='md0 md1 md2 md3 md4 md5 md6 md7 md8 md9' MDOUT=`mdconfig -l` for DEV in $MDDEV do if ! echo $MDOUT | grep -q $DEV then break fi done

shell scripting question (mdconfig device choosing)

2006-01-24 Thread Ensel Sharon
Hello, When I mdconfig a device and _do not_ specify a particular numbered md device (with the -u flag), it just chooses an unused device number for me. Which makes me happy. Unfortunately, mdconfig chooses the next available device, from the highest device currently in use, regardless of

Re: shell scripting question (mdconfig device choosing)

2006-01-24 Thread Chuck Swiger
Ensel Sharon wrote: and I know how to use awk to strip away the leading md from each piece of the output ... but I do not know how to take output like: 8 9 11 14 and decide that the lowest available number is 0. How can I do this ? % echo '9 8 11 14' | sort -nt ' ' | head -1 8 -- -Chuck

Re: shell scripting question (mdconfig device choosing)

2006-01-24 Thread Ensel Sharon
On Tue, 24 Jan 2006, Chuck Swiger wrote: Ensel Sharon wrote: and I know how to use awk to strip away the leading md from each piece of the output ... but I do not know how to take output like: 8 9 11 14 and decide that the lowest available number is 0. How can I do this ? %

Re: shell scripting question (mdconfig device choosing)

2006-01-24 Thread Luke Bakken
Ensel Sharon wrote: and I know how to use awk to strip away the leading md from each piece of the output ... but I do not know how to take output like: 8 9 11 14 and decide that the lowest available number is 0. How can I do this ? % echo '9 8 11 14' | sort -nt ' ' | head

Re: shell scripting question (mdconfig device choosing)

2006-01-24 Thread Ensel Sharon
Luke, On Tue, 24 Jan 2006, Luke Bakken wrote: Yeah, but I am looking for 0 ... 8,9,11,14 are all in use ... but 0-7 are not. I want to: starting with zero, find the lowest number that is NOT in this list (where this list is the output of mdconfig -l, which shows which md devices

Shell scripting question

2005-09-12 Thread Paul Schmehl
I've written a script to check apache to make sure it's running *and* logging. One of the variables I create is named DATEHOUR, and it's created by parsing the output of date in such a way that all I get is the hour (using awk and cut.) I'm comparing DATEHOUR to LOGHOUR, which represents the

Re: Shell scripting question

2005-09-12 Thread Frank Mueller - emendis GmbH
To get the date in the right format you could simply use date +%H Greetz, Ice Paul Schmehl schrieb: I've written a script to check apache to make sure it's running *and* logging. One of the variables I create is named DATEHOUR, and it's created by parsing the output of date in such a way

Re: Shell scripting question

2005-09-12 Thread Paul Schmehl
--On Monday, September 12, 2005 20:37:22 +0200 Frank Mueller - emendis GmbH [EMAIL PROTECTED] wrote: To get the date in the right format you could simply use date +%H That solves one-half of the problem. I would still have to get the hour from the file into the correct format. Otherwise

Re: Shell scripting question

2005-09-12 Thread David Kirchner
On 9/12/05, Paul Schmehl [EMAIL PROTECTED] wrote: How can I strip the leading character from the string so that I can test to see if it's zero? This'll strip the 0, while leaving other numbers intact: $ X=09 $ echo ${X#0} 9 ___

Re: Shell scripting question

2005-09-12 Thread Paul Schmehl
--On Monday, September 12, 2005 13:17:05 -0700 David Kirchner [EMAIL PROTECTED] wrote: On 9/12/05, Paul Schmehl [EMAIL PROTECTED] wrote: How can I strip the leading character from the string so that I can test to see if it's zero? This'll strip the 0, while leaving other numbers intact: $

scripting question, killing a process safely

2003-01-26 Thread Joe Sotham
I am recording audio tapes to wav files using gramofile. I'd like to be able to walk away and automatically shut down the process without corrupting the wav file. I know the tape duration so I was planning to use the following script. I'd appreciate a better or more refined approach: (sleep