Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread markham breitbach
I have some scripts that do fairly crude IPv4/6 validation testing. It is generally assumed that the input is coming from someone who knows what they are doing, but even the best of us have fat fingers sometimes :) Having standardized routines for something like this is great! Thanks, -Markham

Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread Teske, Devin
On Aug 6, 2013, at 10:39 AM, Polytropon wrote: > On Tue, 6 Aug 2013 16:50:37 +, Teske, Devin wrote: >> And yes... to clarify... the port is a mirror of what's in 9.x base. >> (however, see my recent notes in a separate reply; TL;DR: port is >> 9.x only; proceed only if you know you don't care

Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread Polytropon
On Tue, 6 Aug 2013 16:50:37 +, Teske, Devin wrote: > And yes... to clarify... the port is a mirror of what's in 9.x base. > (however, see my recent notes in a separate reply; TL;DR: port is > 9.x only; proceed only if you know you don't care about the dialog(1) > aspects of the library code).

Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread Teske, Devin
On Aug 6, 2013, at 9:43 AM, Polytropon wrote: > On Tue, 06 Aug 2013 10:20:05 -0600, markham breitbach wrote: >> On 13-08-03 8:04 AM, Teske, Devin wrote: >>> Actually, there's /usr/share/bsdconfig/media/tcpip.subr >>> >>> >> I don't seem to have that (FreeBSD 8.3-RELEASE). >> Where would I get

Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread Teske, Devin
On Aug 6, 2013, at 9:20 AM, markham breitbach wrote: > On 13-08-03 8:04 AM, Teske, Devin wrote: >> Actually, there's /usr/share/bsdconfig/media/tcpip.subr >> >> > I don't seem to have that (FreeBSD 8.3-RELEASE). Where would I get that > from? > > It's in up-coming 9.2-R (and present 9.2-

Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread Polytropon
On Tue, 06 Aug 2013 10:20:05 -0600, markham breitbach wrote: > On 13-08-03 8:04 AM, Teske, Devin wrote: > > Actually, there's /usr/share/bsdconfig/media/tcpip.subr > > > > > I don't seem to have that (FreeBSD 8.3-RELEASE). > Where would I get that from? Maybe from sysutils/bsdconfig in the ports

Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread markham breitbach
On 13-08-03 8:04 AM, Teske, Devin wrote: > Actually, there's /usr/share/bsdconfig/media/tcpip.subr > > I don't seem to have that (FreeBSD 8.3-RELEASE). Where would I get that from? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.or

Re: .sh script code to determine IPv4 or IPv6

2013-08-03 Thread Teske, Devin
On Aug 3, 2013, at 5:04 AM, Robert Huff wrote: > > Fbsd8 writes: > >> I have a .sh script that I need to determine if the entered IP >> address is IPv4 or IPv6. >> >> Is there some .sh command that does this? > > Not that I know of. >

Re: .sh script code to determine IPv4 or IPv6

2013-08-03 Thread Teske, Devin
On Aug 3, 2013, at 4:30 AM, Fbsd8 wrote: > I have a .sh script that I need to determine if the entered IP address > is IPv4 or IPv6. > > Is there some .sh command that does this? > In RELENG_9, soon to be released 9.2-R: === FILE: wis === #!/bin/sh DEVICE_SELF_SCAN_AL

.sh script code to determine IPv4 or IPv6

2013-08-03 Thread Robert Huff
Fbsd8 writes: > I have a .sh script that I need to determine if the entered IP > address is IPv4 or IPv6. > > Is there some .sh command that does this? Not that I know of. But ... how hard can it be to figure out whether it

.sh script code to determine IPv4 or IPv6

2013-08-03 Thread Fbsd8
I have a .sh script that I need to determine if the entered IP address is IPv4 or IPv6. Is there some .sh command that does this? Thanks ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To

Re: check variable content size in sh script

2013-05-18 Thread Quartz
I say this from a FreeBSD context. It may entirely be possible that a Linux distro uses bash in /bin/sh Yes. For most (all?) linux distros as well as osx, /bin/sh is actually bash. When I say "emulation mode" I mean running a script with a "#!/bin/sh" header on a system that doesn't have a rea

Re: check variable content size in sh script

2013-05-18 Thread Teske, Devin
On May 18, 2013, at 5:06 PM, Teske, Devin wrote: > > On May 18, 2013, at 4:54 PM, Quartz wrote: > >> >>> #foo works with sh >> >> Is it actually part of the official spec though is what I'm wondering, or is >> it a case of other shells not rejecting 'advanced' statements when running >> in

Re: check variable content size in sh script

2013-05-18 Thread Teske, Devin
On May 18, 2013, at 4:54 PM, Quartz wrote: > >> #foo works with sh > > Is it actually part of the official spec though is what I'm wondering, or is > it a case of other shells not rejecting 'advanced' statements when running in > emulation. > Shells don't have an "emulation mode". The shell

Re: check variable content size in sh script

2013-05-18 Thread Quartz
By default, there is no bash on FreeBSD, Right right... I know this, but forgot what list I was on :) It doesn't help that I always install bash first thing on any freebsd box or it get's installed automatically as part of pc-bsd anyway. __ it has a certai

Re: check variable content size in sh script

2013-05-18 Thread Quartz
#foo works with sh Is it actually part of the official spec though is what I'm wondering, or is it a case of other shells not rejecting 'advanced' statements when running in emulation. At least FreeBSD's implementation of sh (which is ash, I think) supports the # functionality. The rea

Re: check variable content size in sh script

2013-05-18 Thread Teske, Devin
On May 18, 2013, at 9:06 AM, Polytropon wrote: > On Sat, 18 May 2013 11:58:30 -0400, Quartz wrote: >> newfoo=${foo:0:51} >>> >>> That works for bash, not sh. >> >> Ok granted, but I don't think that ${#foo} is straight sh either, so I >> assumed "things bash/tcsh/ksh/whatever accep

Re: check variable content size in sh script

2013-05-18 Thread Polytropon
On Sat, 18 May 2013 11:58:30 -0400, Quartz wrote: > > >> newfoo=${foo:0:51} > >> > > > > That works for bash, not sh. > > Ok granted, but I don't think that ${#foo} is straight sh either, so I > assumed "things bash/tcsh/ksh/whatever accept when running in sh > emulation" were ok. By default,

Re: check variable content size in sh script

2013-05-18 Thread Tim Daneliuk
#foo works with sh On May 18, 2013 10:58:30 AM Quartz wrote: >> newfoo=${foo:0:51} >> > > That works for bash, not sh. Ok granted, but I don't think that ${#foo} is straight sh either, so I assumed "things bash/tcsh/ksh/whatever accept when running in sh emulation" were ok.

Re: check variable content size in sh script

2013-05-18 Thread Quartz
newfoo=${foo:0:51} That works for bash, not sh. Ok granted, but I don't think that ${#foo} is straight sh either, so I assumed "things bash/tcsh/ksh/whatever accept when running in sh emulation" were ok. __ it has a certain smooth-brained appeal _

Re: check variable content size in sh script

2013-05-18 Thread Quartz
However, if the OP wanted to actually truncate $FOO to 51 characters: NEWFOO=$( echo "$FOO" | awk -v max=51 '{print substr($0,0,max)}' ) You don't need all that for a simple truncation/substring, you can do it with a direct assignment: newfoo=${foo:0:51} The three params here are "variabl

Re: check variable content size in sh script

2013-05-18 Thread Tim Daneliuk
On 05/18/2013 10:09 AM, Quartz wrote: However, if the OP wanted to actually truncate $FOO to 51 characters: NEWFOO=$( echo "$FOO" | awk -v max=51 '{print substr($0,0,max)}' ) You don't need all that for a simple truncation/substring, you can do it with a direct assignment: newfoo=${foo:0:5

Re: check variable content size in sh script

2013-05-16 Thread Teske, Devin
On May 16, 2013, at 9:27 AM, Teske, Devin wrote: On May 16, 2013, at 9:06 AM, Teske, Devin wrote: On May 16, 2013, at 8:28 AM, Tim Daneliuk wrote: On 05/16/2013 10:08 AM, Joe wrote: Hello Have script that has max size on content in a variable. How to code size less than 51 characters? FOO=

Re: check variable content size in sh script

2013-05-16 Thread Teske, Devin
On May 16, 2013, at 9:06 AM, Teske, Devin wrote: > > On May 16, 2013, at 8:28 AM, Tim Daneliuk wrote: > >> On 05/16/2013 10:08 AM, Joe wrote: >>> Hello >>> >>> Have script that has max size on content in a variable. >>> How to code size less than 51 characters? >>> >> >> FOO="Some string you

Re: check variable content size in sh script

2013-05-16 Thread Tim Daneliuk
On 05/16/2013 10:45 AM, Dan Nelson wrote: In the last episode (May 16), Tim Daneliuk said: On 05/16/2013 10:08 AM, Joe wrote: Hello Have script that has max size on content in a variable. How to code size less than 51 characters? FOO="Some string you want to check length of" FOOLEN=`echo $F

Re: check variable content size in sh script

2013-05-16 Thread Teske, Devin
On May 16, 2013, at 8:28 AM, Tim Daneliuk wrote: > On 05/16/2013 10:08 AM, Joe wrote: >> Hello >> >> Have script that has max size on content in a variable. >> How to code size less than 51 characters? >> > > FOO="Some string you want to check length of" > FOOLEN=`echo $FOO | wc | awk '{print

Re: check variable content size in sh script

2013-05-16 Thread markham breitbach
something like this: #!/bin/sh if [ $# -lt 1 ] ; then echo "put a nickel in the slot, pal!" exit 1; fi NUMCHARS=`echo $1 | wc -m` if [ $NUMCHARS -lt 51 ] ; then echo "You input "$NUMCHARS" characters." exit 0 else echo "whoa sailor I can't take all that!" exit 1 fi On 13-05-16 9:08 AM, Joe wrote

Re: check variable content size in sh script

2013-05-16 Thread Dan Nelson
In the last episode (May 16), Tim Daneliuk said: > On 05/16/2013 10:08 AM, Joe wrote: > > Hello > > > > Have script that has max size on content in a variable. > > How to code size less than 51 characters? > > > > FOO="Some string you want to check length of" > FOOLEN=`echo $FOO | wc | awk '{print

Re: check variable content size in sh script

2013-05-16 Thread Tim Daneliuk
On 05/16/2013 10:08 AM, Joe wrote: Hello Have script that has max size on content in a variable. How to code size less than 51 characters? FOO="Some string you want to check length of" FOOLEN=`echo $FOO | wc | awk '{print $3}'` You can then use $FOOLEN in a conditional. -- --

check variable content size in sh script

2013-05-16 Thread Joe
Hello Have script that has max size on content in a variable. How to code size less than 51 characters? Thanks ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "

Re: sh script & files

2013-02-20 Thread Fbsd8
Polytropon wrote: On Wed, 20 Feb 2013 07:40:08 -0500, Fbsd8 wrote: # write to file > "${file}" I'm thinking the file is never closed so on power failure I loose the contents of the file. How would I code a command to close the file? The file is closed when the write operation has been fin

Re: sh script & files

2013-02-20 Thread Polytropon
On Wed, 20 Feb 2013 07:40:08 -0500, Fbsd8 wrote: > # write to file > > "${file}" > > I'm thinking the file is never closed so on power failure I loose the > contents of the file. > > How would I code a command to close the file? The file is closed when the write operation has been finished. Yo

sh script & files

2013-02-20 Thread Fbsd8
I noticed that when power fails I loose the contents of some files I am using in a sh script. I read and write the file this way file="/usr/local/etc/filename" # read file . "${file}" # write to file > "${file}" I'm thinking the file is never closed so

Re: sh script ?

2013-01-24 Thread John Levine
>I get this message [: 10.0.10.21: bad number on this code > >[ "${saved_ip}" -eq "${used_ip}" ] && echo "good match" > >Both variables have valid ip addresses in them. >Why does it think the variable content is a number and not text? >What am I doing wrong? My guess would be that you didn't r

Re: [Bulk] Re: sh script ?

2013-01-24 Thread Mike Jeays
On Thu, 24 Jan 2013 16:16:54 -0500 Fbsd8 wrote: > Robert Bonomi wrote: > >> From owner-freebsd-questi...@freebsd.org Thu Jan 24 12:11:42 2013 > >> Date: Thu, 24 Jan 2013 13:07:40 -0500 > >> From: Fbsd8 > >> To: FreeBSD questions > >> S

Re: sh script ?

2013-01-24 Thread Fbsd8
Robert Bonomi wrote: From owner-freebsd-questi...@freebsd.org Thu Jan 24 12:11:42 2013 Date: Thu, 24 Jan 2013 13:07:40 -0500 From: Fbsd8 To: FreeBSD questions Subject: sh script ? I get this message [: 10.0.10.21: bad number on this code [ "${saved_ip}" -eq "${used_ip}&q

Re: sh script ?

2013-01-24 Thread Robert Bonomi
> From owner-freebsd-questi...@freebsd.org Thu Jan 24 12:11:42 2013 > Date: Thu, 24 Jan 2013 13:07:40 -0500 > From: Fbsd8 > To: FreeBSD questions > Subject: sh script ? > > I get this message [: 10.0.10.21: bad number on this code > > [ "${saved_ip}" -

Re: sh script ?

2013-01-24 Thread Rick Miller
On Thu, Jan 24, 2013 at 1:07 PM, Fbsd8 wrote: > I get this message [: 10.0.10.21: bad number on this code > >[ "${saved_ip}" -eq "${used_ip}" ] && echo "good match" > > Both variables have valid ip addresses in them. > Why does it think the variable content is a number and not text? > What am

Re: sh script ?

2013-01-24 Thread Teske, Devin
Use = for string comparison with the [ built-in and -eq for numerical comparison. -- Devin On Jan 24, 2013, at 10:07 AM, Fbsd8 wrote: > I get this message [: 10.0.10.21: bad number on this code > > [ "${saved_ip}" -eq "${used_ip}" ] && echo "good match" > > Both variables have valid ip ad

sh script ?

2013-01-24 Thread Fbsd8
I get this message [: 10.0.10.21: bad number on this code [ "${saved_ip}" -eq "${used_ip}" ] && echo "good match" Both variables have valid ip addresses in them. Why does it think the variable content is a number and not text? What am I doing wrong? Thanks for your help _

Re: sh script code to get file size.

2013-01-18 Thread Robert Bonomi
> From owner-freebsd-questi...@freebsd.org Fri Jan 18 17:30:31 2013 > Date: Fri, 18 Jan 2013 18:26:54 -0500 > From: Fbsd8 > To: FreeBSD questions > Subject: sh script code to get file size. > > In a script in am working on I need to find out the allocated > size of a

Re: sh script code to get file size.

2013-01-18 Thread Chris Hill
On Fri, 18 Jan 2013, Fbsd8 wrote: In a script in am working on I need to find out the allocated size of a sparse file. The only command that comes to mind is "ls -lh" The "du -h" command is not appropriate because it will show the occupied size and not the allocated size. I don't know how to pa

Re: sh script code to get file size.

2013-01-18 Thread Fbsd8
Chris Hill wrote: On Fri, 18 Jan 2013, Fbsd8 wrote: In a script in am working on I need to find out the allocated size of a sparse file. The only command that comes to mind is "ls -lh" The "du -h" command is not appropriate because it will show the occupied size and not the allocated size. I d

Re: sh script code to get file size.

2013-01-18 Thread Fbsd8
In a script in am working on I need to find out the allocated size of a sparse file. The only command that comes to mind is "ls -lh" The "du -h" command is not appropriate because it will show the occupied size and not the allocated size. I don't know how to parse out to the position in the ou

Re: sh script code to get file size.

2013-01-18 Thread Vincent Hoffman
On 18/01/2013 23:26, Fbsd8 wrote: > In a script in am working on I need to find out the allocated > size of a sparse file. > The only command that comes to mind is "ls -lh" > The "du -h" command is not appropriate because it will show > the occupied size and not the allocated size. > > I don't know

Re: sh script code to get file size.

2013-01-18 Thread Dan Nelson
In the last episode (Jan 18), Fbsd8 said: > In a script in am working on I need to find out the allocated > size of a sparse file. > The only command that comes to mind is "ls -lh" > The "du -h" command is not appropriate because it will show > the occupied size and not the allocated size. > > I d

sh script code to get file size.

2013-01-18 Thread Fbsd8
In a script in am working on I need to find out the allocated size of a sparse file. The only command that comes to mind is "ls -lh" The "du -h" command is not appropriate because it will show the occupied size and not the allocated size. I don't know how to parse out to the position in the outpu

Re: sh script problem with capturing return code

2013-01-14 Thread Fbsd8
Lowell Gilbert wrote: Fbsd8 writes: Lowell Gilbert wrote: This fixes the problem that was bothering you, but the interactions of different features are complicated, and many of them are documented in fairly loose language. Is that the diplomatic way of saying the manpage for mtree sucks,

Re: sh script problem with capturing return code

2013-01-14 Thread Lowell Gilbert
Fbsd8 writes: > Lowell Gilbert wrote: >> This fixes the problem that was bothering you, but the interactions of >> different features are complicated, and many of them are documented in >> fairly loose language. >> > Is that the diplomatic way of saying the manpage for mtree sucks, and > leaves

Re: sh script problem with capturing return code

2013-01-14 Thread Lowell Gilbert
Fbsd8 writes: > Let me be sure I understand you correctly. > Your saying you tested the NetBSD version of mtree that was committed > into 10.0 head and it also has the bug we found? No. The port is not complete. All I did was a code inspection. ___ fre

Re: sh script problem with capturing return code

2013-01-14 Thread Fbsd8
Lowell Gilbert wrote: Fbsd8 writes: Lowell Gilbert wrote: Lowell Gilbert writes: I think it's a real bug, and the test cases don't cover "extra" elements at all. Now I just have to figure out the right fix. I'm pretty sure that the fix is just to set rval on jumping to the "extra" tag in

Re: sh script problem with capturing return code

2013-01-14 Thread Fbsd8
Lowell Gilbert wrote: Adam Vande More writes: On Wed, Jan 9, 2013 at 7:23 PM, Lowell Gilbert < freebsd-questions-lo...@be-well.ilk.org> wrote: Lowell Gilbert writes: I think it's a real bug, and the test cases don't cover "extra" elements at all. Now I just have to figure out the right fi

Re: sh script problem with capturing return code

2013-01-13 Thread Lowell Gilbert
Adam Vande More writes: > On Wed, Jan 9, 2013 at 7:23 PM, Lowell Gilbert < > freebsd-questions-lo...@be-well.ilk.org> wrote: > >> Lowell Gilbert writes: >> >> > I think it's a real bug, and the test cases don't cover "extra" elements >> > at all. Now I just have to figure out the right fix. >> >

Re: sh script problem with capturing return code

2013-01-13 Thread Lowell Gilbert
Fbsd8 writes: > Lowell Gilbert wrote: >> Lowell Gilbert writes: >> >>> I think it's a real bug, and the test cases don't cover "extra" elements >>> at all. Now I just have to figure out the right fix. >> >> I'm pretty sure that the fix is just to set rval on jumping to the >> "extra" tag in vwal

Re: sh script problem with capturing return code

2013-01-09 Thread Adam Vande More
On Wed, Jan 9, 2013 at 7:23 PM, Lowell Gilbert < freebsd-questions-lo...@be-well.ilk.org> wrote: > Lowell Gilbert writes: > > > I think it's a real bug, and the test cases don't cover "extra" elements > > at all. Now I just have to figure out the right fix. > > I'm pretty sure that the fix is jus

Re: sh script problem with capturing return code

2013-01-09 Thread Fbsd8
Lowell Gilbert wrote: Lowell Gilbert writes: I think it's a real bug, and the test cases don't cover "extra" elements at all. Now I just have to figure out the right fix. I'm pretty sure that the fix is just to set rval on jumping to the "extra" tag in vwalk() in src/usr.sbin/mtree/verify.c.

Re: sh script problem with capturing return code

2013-01-09 Thread Lowell Gilbert
Lowell Gilbert writes: > I think it's a real bug, and the test cases don't cover "extra" elements > at all. Now I just have to figure out the right fix. I'm pretty sure that the fix is just to set rval on jumping to the "extra" tag in vwalk() in src/usr.sbin/mtree/verify.c. But my hot water hea

Re: sh script problem with capturing return code

2013-01-09 Thread Lowell Gilbert
Lowell Gilbert writes: > It's not; ignore my example. The extra directory was under the ignored > directory, so it's testing the right properties. I think if I create the > new subdirectory under the other main directory, it would be right. Confirmed. The test case now looks like this: =

Re: sh script problem with capturing return code

2013-01-09 Thread Lowell Gilbert
Lowell Gilbert writes: > and I think the problem you're having is that the second "echo $?" > should be 2, although the others are correct at 0. Is that correct? It's not; ignore my example. The extra directory was under the ignored directory, so it's testing the right properties. I think if I

Re: sh script problem with capturing return code

2013-01-09 Thread Lowell Gilbert
Fbsd8 writes: > So the question remains, why is mtree giving a return of zero when it > finds directories on the target that are not in the spec file? Okay, I had a hard time figuring out your examples, but I think I've got an independent repeatable test case for the problem. ==

Re: sh script problem with capturing return code

2013-01-09 Thread Fbsd8
Lowell Gilbert wrote: Fbsd8 writes: Polytropon wrote: On Tue, 08 Jan 2013 16:30:49 -0500, Fbsd8 wrote: I can not get the return code from mtree to control the displaying of a error message. The mtree at the end of the script does function correctly because I can tell from the printed output

Re: sh script problem with capturing return code

2013-01-08 Thread Lowell Gilbert
Fbsd8 writes: > Polytropon wrote: >> On Tue, 08 Jan 2013 16:30:49 -0500, Fbsd8 wrote: >>> I can not get the return code from mtree to control >>> the displaying of a error message. >>> >>> The mtree at the end of the script does function correctly >>> because I can tell from the printed output. >

Re: sh script problem with capturing return code

2013-01-08 Thread Fbsd8
Polytropon wrote: On Tue, 08 Jan 2013 16:30:49 -0500, Fbsd8 wrote: I can not get the return code from mtree to control the displaying of a error message. The mtree at the end of the script does function correctly because I can tell from the printed output. When mtree prints comments saying "ex

Re: sh script problem with capturing return code

2013-01-08 Thread Polytropon
On Tue, 08 Jan 2013 16:30:49 -0500, Fbsd8 wrote: > > I can not get the return code from mtree to control > the displaying of a error message. > > The mtree at the end of the script does function correctly > because I can tell from the printed output. > > When mtree prints comments saying "extra"

sh script problem with capturing return code

2013-01-08 Thread Fbsd8
I can not get the return code from mtree to control the displaying of a error message. The mtree at the end of the script does function correctly because I can tell from the printed output. When mtree prints comments saying "extra" that means the directory being read does not match the specifi

Re: command to strip suffix in .sh script

2010-06-03 Thread George Davidovich
On Thu, Jun 03, 2010 at 11:11:16PM +0700, Anh Ky Huynh wrote: > On Wed, 02 Jun 2010 20:25:36 -0400 Vinny wrote: > > On 06/02/2010 04:30, Matthew Seaman wrote: > > > On 02/06/2010 09:24:01, Matthias Apitz wrote: > > > > Aiza wrote: > > > > > > > > > I have this code > > [snip] > > > > $ echo 'archiv

Re: command to strip suffix in .sh script

2010-06-03 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/06/2010 17:11:16, Anh Ky Huynh wrote: > On Wed, 02 Jun 2010 20:25:36 -0400 > Vinny wrote: >> On 06/02/2010 04:30, Matthew Seaman wrote: >>> archive_name=${fromarchive%-*} >> Thanks Matthew, that's really neat. It took me a long time >> to fin

Re: command to strip suffix in .sh script

2010-06-03 Thread Anh Ky Huynh
On Wed, 02 Jun 2010 20:25:36 -0400 Vinny wrote: > On 06/02/2010 04:30, Matthew Seaman wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > On 02/06/2010 09:24:01, Matthias Apitz wrote: > >> El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza > >> escribió: > >> > >>> I

Re: command to strip suffix in .sh script

2010-06-02 Thread Vinny
On 06/02/2010 04:30, Matthew Seaman wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/06/2010 09:24:01, Matthias Apitz wrote: El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza escribió: I have this code [snip] $ echo 'archivename-201006021514.34.tar.gz' | sed 's/-.*$//

Re: command to strip suffix in .sh script

2010-06-02 Thread Polytropon
On Wed, 02 Jun 2010 16:15:22 +0800, Aiza wrote: > I have this code > > archive_name=`echo -n "${fromarchive}" | tr -c '[:alnum:]' _` > > ` is the key under Esc key and ' key is next to enter key. > > fromarchive value is archivename-201006021514.34.tar.gz > > I want to strip the suffix -20100

Re: command to strip suffix in .sh script

2010-06-02 Thread Adam Vande More
On Wed, Jun 2, 2010 at 3:24 AM, Matthias Apitz wrote: > El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza escribió: > > > I have this code > > > > archive_name=`echo -n "${fromarchive}" | tr -c '[:alnum:]' _` > > > > ` is the key under Esc key and ' key is next to enter key. > > > > f

Re: command to strip suffix in .sh script

2010-06-02 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/06/2010 09:24:01, Matthias Apitz wrote: > El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza escribió: > >> I have this code >> >> archive_name=`echo -n "${fromarchive}" | tr -c '[:alnum:]' _` >> >> ` is the key under Esc key and ' ke

Re: command to strip suffix in .sh script

2010-06-02 Thread Matthias Apitz
El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza escribió: > I have this code > > archive_name=`echo -n "${fromarchive}" | tr -c '[:alnum:]' _` > > ` is the key under Esc key and ' key is next to enter key. > > fromarchive value is archivename-201006021514.34.tar.gz > > I want to

command to strip suffix in .sh script

2010-06-02 Thread Aiza
I have this code archive_name=`echo -n "${fromarchive}" | tr -c '[:alnum:]' _` ` is the key under Esc key and ' key is next to enter key. fromarchive value is archivename-201006021514.34.tar.gz I want to strip the suffix -201006021514.34.tar.gz from the archivename. The archivename can be up

Re: sh script writing help

2010-05-30 Thread Giorgos Keramidas
On Sun, 30 May 2010 13:14:01 +0800, Aiza wrote: > In a .sh type script I have && exerr " very long message gt 250 char" > all on the same line. This is a real pain to edit. > > Is there some code a can use to continue this on the next line so I > can see it on the screen and still have the command

Re: sh script writing help

2010-05-30 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/05/2010 07:58:58, Aiza wrote: > Anh Ky Huynh wrote: >> On Sun, 30 May 2010 14:10:36 +0800 >> Aiza wrote: >> >>> Dan Nelson wrote: In the last episode (May 30), Aiza said: > In a .sh type script I have && exerr " very long message gt 250

Re: sh script writing help

2010-05-29 Thread Aiza
Anh Ky Huynh wrote: On Sun, 30 May 2010 14:10:36 +0800 Aiza wrote: Dan Nelson wrote: In the last episode (May 30), Aiza said: In a .sh type script I have && exerr " very long message gt 250 char" all on the same line. This is a real pain to edit. Is there some code a can use to continue thi

Re: sh script writing help

2010-05-29 Thread Anh Ky Huynh
On Sun, 30 May 2010 14:10:36 +0800 Aiza wrote: > Dan Nelson wrote: > > In the last episode (May 30), Aiza said: > >> In a .sh type script I have && exerr " very long message gt 250 > >> char" all on the same line. This is a real pain to edit. > >> > >> Is there some code a can use to continue thi

Re: sh script writing help

2010-05-29 Thread Aiza
Dan Nelson wrote: In the last episode (May 30), Aiza said: In a .sh type script I have && exerr " very long message gt 250 char" all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the c

Re: sh script writing help

2010-05-29 Thread Dan Nelson
In the last episode (May 30), Aiza said: > In a .sh type script I have && exerr " very long message gt 250 char" > all on the same line. This is a real pain to edit. > > Is there some code a can use to continue this on the next line so I can > see it on the screen and still have the command func

sh script writing help

2010-05-29 Thread Aiza
In a .sh type script I have && exerr " very long message gt 250 char" all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. thanks __

Re: sh script difficulties (running parallel functions)

2007-11-01 Thread Dan Nelson
In the last episode (Nov 01), David Naylor said: > Hi, > > I am having a hard time getting (very complex script for me) to work. The > basic idea is that this script runs a bunch of tarkets, many of which are > time consuming but low on resources (such as downloading files). Now if I > run the t

Re: sh script difficulties (running parallel functions)

2007-11-01 Thread Jan Grant
On Thu, 1 Nov 2007, David Naylor wrote: > Hi, > > I am having a hard time getting (very complex script for me) to work. The > basic idea is that this script runs a bunch of tarkets, many of which are > time consuming but low on resources (such as downloading files). Now if I > run the tarkets a

Re: sh script difficulties (running parallel functions)

2007-11-01 Thread Andy Harrison
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/1/07, David Naylor wrote: > # !!! Somehow wait for over workers to finish before continuing !!! > } > > #Finished > > Furthermore, how can signals be handled such that the signals get > accumulated and once all the other workers have finishe

sh script difficulties (running parallel functions)

2007-11-01 Thread David Naylor
Hi, I am having a hard time getting (very complex script for me) to work. The basic idea is that this script runs a bunch of tarkets, many of which are time consuming but low on resources (such as downloading files). Now if I run the tarkets all at once (given some dependancy issues) it greatly

RE: unexpected result from sh script with `date`

2007-02-05 Thread [EMAIL PROTECTED]
On Fri, 2 Feb 2007 22:11:56 +1100, Tigger <[EMAIL PROTECTED]> wrote > Hello, the following simply sh script is outputting unexpected results. > Any idea why? > --script-- > #!/bin/sh > started=`date` > echo "Started at: $started" > echo "Finished : &qu

Re: unexpected result from sh script with `date`

2007-02-02 Thread Erik Trulsson
On Fri, Feb 02, 2007 at 01:48:31PM +0100, J65nko wrote: > On 2/2/07, Tigger <[EMAIL PROTECTED]> wrote: > >Hello, the following simply sh script is outputting unexpected results. > >Any idea why? > > > >--script-- > > > >#!/bin/sh > > > >

Re: unexpected result from sh script with `date`

2007-02-02 Thread J65nko
On 2/2/07, Tigger <[EMAIL PROTECTED]> wrote: Hello, the following simply sh script is outputting unexpected results. Any idea why? --script-- #!/bin/sh started=`date` echo "Started at: $started" echo "Finished : "`date` exit --output-- Started at: Fri Feb 2

unexpected result from sh script with `date`

2007-02-02 Thread Tigger
Hello, the following simply sh script is outputting unexpected results. Any idea why? --script-- #!/bin/sh started=`date` echo "Started at: $started" echo "Finished : "`date` exit --output-- Started at: Fri Feb 2 22:13:51 EST 2007 Finished : Fri Feb 2 22:13:51

Re: Need /bin/sh script help

2006-04-12 Thread Garrett Cooper
Garrett Cooper wrote: Hello again all, Just making a series of sh scripts to help automate updating and whatnot of my fileserver (since I am trying to avoid having mistakes occur with my system, and maybe help the community out a bit by providing some decent means of updating their own mac

Re: Need /bin/sh script help

2006-04-11 Thread Jan Grant
On Tue, 11 Apr 2006, [EMAIL PROTECTED] wrote: > On Mon, 10 Apr 2006 22:30:32 -0700 Garrett Cooper wrote (my brief response > follows all of his text): > > Just making a series of sh scripts to help automate updating and > whatnot of my fileserver (since I am trying to avoid having mistake

Re: Need /bin/sh script help

2006-04-11 Thread [EMAIL PROTECTED]
On Mon, 10 Apr 2006 22:30:32 -0700 Garrett Cooper wrote (my brief response follows all of his text): Just making a series of sh scripts to help automate updating and whatnot of my fileserver (since I am trying to avoid having mistakes occur with my system, and maybe help the community out

Re: Need /bin/sh script help

2006-04-11 Thread Parv
in message <[EMAIL PROTECTED]>, wrote Garrett Cooper thusly... > > I was wondering if anyone could help me out with the following > script I've developing (the grep if statements are incorrect..): > > #!/bin/sh > # > > KC=""; > > cd /usr/src; > > if [ -n `grep -e s/KERNCONF=/ /etc/make.conf` ]

Re: Need /bin/sh script help

2006-04-11 Thread RW
On Tuesday 11 April 2006 06:30, Garrett Cooper wrote: > cd /usr/src; > if [ -n `grep -e s/KERNCONF=/ /etc/make.conf` ] # want to look for > KERNCONF in /etc/make.conf if [ `make -V KERNCONF` ] > read KERNCONF; > KC="KERNCONF=$KERNCONF"; > fi You need to check that KC actually e

Need /bin/sh script help

2006-04-10 Thread Garrett Cooper
Hello again all, Just making a series of sh scripts to help automate updating and whatnot of my fileserver (since I am trying to avoid having mistakes occur with my system, and maybe help the community out a bit by providing some decent means of updating their own machines), and I was wonde

Re: help with sh script

2005-07-04 Thread FreeBSD questions mailing list
On 03 jul 2005, at 19:03, fbsd_user wrote: On Sun, 3 Jul 2005 12:14:05 -0400 "fbsd_user" <[EMAIL PROTECTED]> wrote: Thanks but I need a little more help. num_ip="(printf $raw_ip | sed 's/\.//g')" gives me a error. What would the correct syntax be? I am trying to write script to insert ru

Re: help with sh script

2005-07-04 Thread Roland Smith
On Sun, Jul 03, 2005 at 01:03:40PM -0400, fbsd_user wrote: > > I get this error "printf missing format character" > > Does sed need different syntax or have I got it all wrong? Issue the following command and be enlightend: man 1 printf Or just use 'echo' instead. Roland -- R.F.Smith (http:/

Re: help with sh script

2005-07-03 Thread Giorgos Keramidas
On 2005-07-03 09:39, fbsd_user <[EMAIL PROTECTED]> wrote: > What is the sh coding to strip the periods from a IP address?? > > raw_ip='10.0.10.5' this is starting > num_ip='100105'and this is what I need to convert to. There are many ways: echo "${raw_ip}" | sed -e 's/\.//g' echo "${

Re: help with sh script

2005-07-03 Thread Alejandro Pulver
On Sun, 3 Jul 2005 14:59:32 -0400 "fbsd_user" <[EMAIL PROTECTED]> wrote: > > > std_text='No ALTQ support in kernel ALTQ related functions disabled' > ret_ob='No ALTQ support in kernel ALTQ related functions disabled > OK' > > ret_ob=`printf "$ret_ob" | sed 's/\$std_text//g'` > Does not strip of

Re: help with sh script

2005-07-03 Thread FreeBSD questions mailing list
On 03 jul 2005, at 20:59, fbsd_user wrote: std_text='No ALTQ support in kernel ALTQ related functions disabled' ret_ob='No ALTQ support in kernel ALTQ related functions disabled OK' ret_ob=`printf "$ret_ob" | sed 's/\$std_text//g'` Does not strip off the std_text stuff. How would I code a s

  1   2   >