Re: shell script problem

2012-12-24 Thread Ian Smith
In freebsd-questions Digest, Vol 447, Issue 1, Message: 13 On Sun, 23 Dec 2012 18:48:12 +0100 Dh?nin Jean-Jacques > 2012/12/23 Polytropon > > #!/bin/sh > > > > cat foo.txt | while read LINE1 > > do > > cat bar.txt | while read LINE2 > > do > > if [ "$LINE1

Re: shell script problem

2012-12-23 Thread  Dhénin Jean-Jacques
2012/12/23 Polytropon > > #!/bin/sh > > cat foo.txt | while read LINE1 > do > cat bar.txt | while read LINE2 > do > if [ "$LINE1" = "$LINE2" ]; then > sw="1" > echo "Current value of sw is : " $sw >

Re: shell script problem

2012-12-23 Thread  Dhénin Jean-Jacques
2012/12/23 Polytropon > On Sun, 23 Dec 2012 10:34:34 +0100, Polytropon wrote: > > First, the lines with "read" have to be: > > > > cat /foo/bar.txt | while read $LINE1 > > > > cat /foo/bar/foo/bar.txt | while read $LINE2 > > > > Reason: $LINE1 and $LINE2 will be evaluated here, they are "em

Re: shell script problem

2012-12-23 Thread Steve O'Hara-Smith
On Sun, 23 Dec 2012 09:57:02 + Matthew Seaman wrote: > Hmmm I'd just like to draw your attention to the comm(1) program, > which lets you find lines common to two files, or only in one or other > of a pair of inputs, very easily. The only slight gotcha is that the > input files have to b

Re: shell script problem

2012-12-23 Thread Matthew Seaman
On 23/12/2012 09:43, Polytropon wrote: > On Sun, 23 Dec 2012 10:34:34 +0100, Polytropon wrote: >> First, the lines with "read" have to be: >> >> cat /foo/bar.txt | while read $LINE1 >> >> cat /foo/bar/foo/bar.txt | while read $LINE2 >> >> Reason: $LINE1 and $LINE2 will be evaluated here, they

Re: shell script problem

2012-12-23 Thread Polytropon
On Sun, 23 Dec 2012 10:34:34 +0100, Polytropon wrote: > First, the lines with "read" have to be: > > cat /foo/bar.txt | while read $LINE1 > > cat /foo/bar/foo/bar.txt | while read $LINE2 > > Reason: $LINE1 and $LINE2 will be evaluated here, they are "empty > string", causing "read" to thro

Re: shell script problem

2012-12-23 Thread Polytropon
On Sun, 23 Dec 2012 01:05:35 -0800 (PST), Jack Mc Lauren wrote: > Hi all > Please take a look at the script below wich I've wrote : > 1- cat /foo/bar.txt | while read $LINE12- do3-    cat /foo/bar/foo/bar.txt | > while read $LINE24-    do 5-         if [ "$LINE1" = "$LINE2" ]; then6-       >    

shell script problem

2012-12-23 Thread Jack Mc Lauren
Hi all Please take a look at the script below wich I've wrote : 1- cat /foo/bar.txt | while read $LINE12- do3-    cat /foo/bar/foo/bar.txt | while read $LINE24-    do 5-         if [ "$LINE1" = "$LINE2" ]; then6-               sw="1"7-               echo "Current value of sw is : " $sw8-        

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 04:30 PM, Matthew Seaman wrote: On 07/01/2012 13:57, RW wrote: On Sat, 07 Jan 2012 15:37:49 +0200 Kaya Saman wrote: n terms of paths this is what I'm doing: I'm in a FreeBSD jail logged in by - #jexec tcsh which gets me in as root. Crontab is being run as root so paths should b

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 03:57 PM, RW wrote: On Sat, 07 Jan 2012 15:37:49 +0200 Kaya Saman wrote: n terms of paths this is what I'm doing: I'm in a FreeBSD jail logged in by - #jexec tcsh which gets me in as root. Crontab is being run as root so paths should be the same no? PATH is set at the top of /e

Re: Having problems running shell script from crontab

2012-01-07 Thread Matthew Seaman
On 07/01/2012 13:57, RW wrote: > On Sat, 07 Jan 2012 15:37:49 +0200 > Kaya Saman wrote: > > n terms of paths this is what I'm doing: I'm in a FreeBSD jail >> logged in by - #jexec tcsh >> >> which gets me in as root. Crontab is being run as root so paths >> should be the same no? No -- you can't

Re: Having problems running shell script from crontab

2012-01-07 Thread RW
On Sat, 07 Jan 2012 15:37:49 +0200 Kaya Saman wrote: n terms of paths this is what I'm doing: I'm in a FreeBSD jail > logged in by - #jexec tcsh > > which gets me in as root. Crontab is being run as root so paths > should be the same no? PATH is set at the top of /etc/crontab __

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 03:22 PM, RW wrote: On Sat, 07 Jan 2012 14:21:51 +0200 Kaya Saman wrote: The strange thing is that if I run this script manually /root/java_restart/java_restart.sh it works fine and does what it's supposed to do. The commonest reason for scripts that that work from a terminal fail

Re: Having problems running shell script from crontab

2012-01-07 Thread RW
On Sat, 07 Jan 2012 14:21:51 +0200 Kaya Saman wrote: > The strange thing is that if I run this script manually > /root/java_restart/java_restart.sh it works fine and does what it's > supposed to do. The commonest reason for scripts that that work from a terminal failing under cron is that the e

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 03:05 PM, Yuri Pankov wrote: On Sat, Jan 07, 2012 at 02:21:51PM +0200, Kaya Saman wrote: Hi, I wrote a shell script to detect if the port of tomcat was in use or not then restart if the port wasn't online; due to tomcat segfaulting as my system hasn't got enough mem

Re: Having problems running shell script from crontab

2012-01-07 Thread Yuri Pankov
On Sat, Jan 07, 2012 at 02:21:51PM +0200, Kaya Saman wrote: > Hi, > > I wrote a shell script to detect if the port of tomcat was in use or not > then restart if the port wasn't online; due to tomcat segfaulting as my > system hasn't got enough memory for it. > &

Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
Hi, I wrote a shell script to detect if the port of tomcat was in use or not then restart if the port wasn't online; due to tomcat segfaulting as my system hasn't got enough memory for it. This is the shell script: #!/usr/local/bin/bash ntstat=`netstat -ap tcp | grep 8180 |

Re: Shell script termination with exit function in backquotes

2011-03-22 Thread Devin Teske
On Tue, 2011-03-22 at 12:32 +, RW wrote: > On Sat, 19 Mar 2011 09:44:57 -0700 > Devin Teske wrote: > > > > At least two variations to the rule that { ... } is a block of > > commands executed in the current shell are: > > > > 1. When the block appears as a function > > Is that correct?

Re: Shell script termination with exit function in backquotes

2011-03-22 Thread Jilles Tjoelker
Maxim Khitrov wrote: > [$(exit) exits the main shell environment] This is a bug which is fixed in 9-current. Another message: > On Sat, Mar 19, 2011 at 12:44 PM, Devin Teske wrote: > > [all elements of multi-command pipelines are executed in a subshell] > > You're learning that there are deviat

Re: Shell script termination with exit function in backquotes

2011-03-22 Thread RW
On Sat, 19 Mar 2011 09:44:57 -0700 Devin Teske wrote: > At least two variations to the rule that { ... } is a block of > commands executed in the current shell are: > > 1. When the block appears as a function Is that correct? I'd assumed that functions do execute in the current shell since yo

Re: Shell script termination with exit function in backquotes

2011-03-20 Thread Ian Smith
in freebsd-questions Digest, Vol 354, Issue 10, Message: 4 On Sat, 19 Mar 2011 12:15:26 -0400 Maxim Khitrov wrote: > Here's another, but related, problem that I just ran into. The man page > reads: > > Commands may be grouped by writing either >(list) > or >

Re: Shell script termination with exit function in backquotes

2011-03-19 Thread Andres Perera
On Sat, Mar 19, 2011 at 11:45 AM, Maxim Khitrov wrote: > > Here's another, but related, problem that I just ran into. The man page reads: > >     Commands may be grouped by writing either >           (list) >     or >           { list; } >     The first form executes the commands in a subshell.  N

Re: Shell script termination with exit function in backquotes

2011-03-19 Thread perryh
Maxim Khitrov wrote: > ... these deviations should be noted in the man page to > help eliminate such surprises. A single sentence would > have sufficed in this case. As always, I'm sure patches would be welcome :) ___ freebsd-questions@freebsd.org mail

Re: Shell script termination with exit function in backquotes

2011-03-19 Thread Maxim Khitrov
On Sat, Mar 19, 2011 at 12:44 PM, Devin Teske wrote: > > On Mar 19, 2011, at 9:15 AM, Maxim Khitrov wrote: > >> On Mon, Mar 14, 2011 at 6:40 PM, Andres Perera wrote: >>> On Mon, Mar 14, 2011 at 7:46 AM, Maxim Khitrov wrote: On Mon, Mar 14, 2011 at 3:16 AM, Andres Perera wrote: > On Sun

Re: Shell script termination with exit function in backquotes

2011-03-19 Thread Devin Teske
On Mar 19, 2011, at 9:15 AM, Maxim Khitrov wrote: > On Mon, Mar 14, 2011 at 6:40 PM, Andres Perera wrote: >> On Mon, Mar 14, 2011 at 7:46 AM, Maxim Khitrov wrote: >>> On Mon, Mar 14, 2011 at 3:16 AM, Andres Perera wrote: On Sun, Mar 13, 2011 at 9:49 PM, Devin Teske wrote: > If you ma

Re: Shell script termination with exit function in backquotes

2011-03-19 Thread Maxim Khitrov
On Mon, Mar 14, 2011 at 6:40 PM, Andres Perera wrote: > On Mon, Mar 14, 2011 at 7:46 AM, Maxim Khitrov wrote: >> On Mon, Mar 14, 2011 at 3:16 AM, Andres Perera wrote: >>> On Sun, Mar 13, 2011 at 9:49 PM, Devin Teske wrote: If you make the changes that I've suggested, you'll have consistent

Re: Shell script termination with exit function in backquotes

2011-03-14 Thread Andres Perera
On Mon, Mar 14, 2011 at 7:46 AM, Maxim Khitrov wrote: > On Mon, Mar 14, 2011 at 3:16 AM, Andres Perera wrote: >> On Sun, Mar 13, 2011 at 9:49 PM, Devin Teske wrote: >>> If you make the changes that I've suggested, you'll have consistent >>> execution. The reason you're having inconsistent behav

Re: Shell script termination with exit function in backquotes

2011-03-14 Thread Maxim Khitrov
On Mon, Mar 14, 2011 at 3:16 AM, Andres Perera wrote: > On Sun, Mar 13, 2011 at 9:49 PM, Devin Teske wrote: >> If you make the changes that I've suggested, you'll have consistent >> execution. The reason you're having inconsistent behavior is because Linux >> has /bin/sh symbolically linked to

Re: Shell script termination with exit function in backquotes

2011-03-14 Thread Andres Perera
On Sun, Mar 13, 2011 at 9:49 PM, Devin Teske wrote: > If you make the changes that I've suggested, you'll have consistent > execution. The reason you're having inconsistent behavior is because Linux > has /bin/sh symbolically linked to /bin/bash while FreeBSD has a more > traditional shell (we'

Re: Shell script termination with exit function in backquotes

2011-03-14 Thread Andres Perera
ash tries to overoptimize by running certain command substitutions without a subshell On Sun, Mar 13, 2011 at 7:56 PM, Maxim Khitrov wrote: > Hello everyone, > > I might be doing something dumb here, but this doesn't make sense to > me. When I run the following script, I would expect to see no ou

Re: Shell script termination with exit function in backquotes

2011-03-13 Thread Devin Teske
On Mar 13, 2011, at 5:26 PM, Maxim Khitrov wrote: > Hello everyone, > > I might be doing something dumb here, but this doesn't make sense to > me. When I run the following script, I would expect to see no output: > > > #!/bin/sh > > exit_prog() > { > echo -n 'before' > exit 0

Re: Shell script termination with exit function in backquotes

2011-03-13 Thread Maxim Khitrov
On Sun, Mar 13, 2011 at 9:59 PM, Scott Ballantyne wrote: > On Sun, Mar 13, 2011 at 8:26 PM, Maxim Khitrov wrote: >> >> Hello everyone, >> >> I might be doing something dumb here, but this doesn't make sense to >> me. When I run the following script, I would expect to see no output: >> >> >>

Shell script termination with exit function in backquotes

2011-03-13 Thread Maxim Khitrov
Hello everyone, I might be doing something dumb here, but this doesn't make sense to me. When I run the following script, I would expect to see no output: #!/bin/sh exit_prog() { echo -n 'before' exit 0 echo -n 'after' } echo line 1: `exit_prog` echo line 2: echo li

Re: problem with shell script

2011-01-13 Thread Devin Teske
On Thu, 2011-01-13 at 14:45 -0600, Robert Bonomi wrote: > > Date: Wed, 12 Jan 2011 15:01:45 +0100 > > From: Frank Bonnet > > Subject: problem with shell script > > > > Hello > > > > I'm in trouble with a simple shell script that give erroneous value

Re: problem with shell script

2011-01-13 Thread Robert Bonomi
> Date: Wed, 12 Jan 2011 15:01:45 +0100 > From: Frank Bonnet > Subject: problem with shell script > > Hello > > I'm in trouble with a simple shell script that give erroneous value when > running ... > > If I run commands interactively everything runs well

Re: problem with shell script

2011-01-13 Thread Samuel Martín Moro
he number of outputed lines, using [p]grep and wc makes two processes, while awk can do it all alone. awk ftw! On Wed, Jan 12, 2011 at 3:17 PM, wrote: > Hello > > I'm in trouble with a simple shell script that give > erroneous value when running ... > > If I run commands in

Re: problem with shell script

2011-01-13 Thread Julien Cigar
just use: pgrep "slapd" On 01/12/2011 15:17, four.harris...@googlemail.com wrote: Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well > ps ax | grep slapd | grep -v grep | wc -l

problem with shell script

2011-01-13 Thread four . harrisons
Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well > ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the following shell script : #!/bin/sh SD=0 SD=`ps -ax | grep slapd | grep

Re: problem with shell script

2011-01-13 Thread Igor V. Ruzanov
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 13 Jan 2011, per...@pluto.rain.com wrote: |David Scheidt wrote: | |> ps ax | grep [s]lapd | wc -l |> |> The [] creates a one-character class that doesn't match the regex. | |Doesn't [s]lapd need to be quoted? [] are special to (at least some

Re: problem with shell script

2011-01-13 Thread perryh
David Scheidt wrote: > ps ax | grep [s]lapd | wc -l > > The [] creates a one-character class that doesn't match the regex. Doesn't [s]lapd need to be quoted? [] are special to (at least some) shells. ___ freebsd-questions@freebsd.org mailing list http

Re: problem with shell script

2011-01-12 Thread Jonathan McKeown
On Wednesday 12 January 2011 17:58:33 David Scheidt wrote: > > ps ax | grep [s]lapd | wc -l > > The [] creates a one-character class that doesn't match the regex. Easier > to type and grep should be a bit faster. And you can save another process by using ps ax | grep -c '[s]lapd' Although as o

Re: problem with shell script

2011-01-12 Thread Ryuichiro Hara
(2011/01/12 23:01), Frank Bonnet wrote: Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well > ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the following shell script : #!/bin

Re: problem with shell script

2011-01-12 Thread Ryuichiro Hara
(2011/01/13 01:00), Warren Block wrote: On Wed, 12 Jan 2011, Samuel Mart?n Moro wrote: On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman wrote: On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet wrote: I'm in trouble with a simple shell script that give erroneous value when running ...

Re: problem with shell script

2011-01-12 Thread Chip Camden
Quoth Frank Bonnet on Wednesday, 12 January 2011: > Hello > > I'm in trouble with a simple shell script that give > erroneous value when running ... > > If I run commands interactively everything runs well > > > ps ax | grep slapd | grep -v grep | wc -l >

Re: problem with shell script

2011-01-12 Thread Warren Block
On Wed, 12 Jan 2011, Samuel Mart?n Moro wrote: On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman wrote: On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet wrote: I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything

Re: problem with shell script

2011-01-12 Thread David Scheidt
On Jan 12, 2011, at 10:43 AM, Samuel Martín Moro wrote: > On W >> >>>> If I run in the following shell script : >>>> >>>> #!/bin/sh >>>> SD=0 >>>> SD=`ps -ax | grep slapd | grep -v grep | wc -l` >>>> echo

Re: problem with shell script

2011-01-12 Thread Samuel Martín Moro
On Wed, Jan 12, 2011 at 4:34 PM, Samuel Martín Moro wrote: > > > On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman wrote: > >> On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet wrote: >> >> > Hello >> > >> > I'm in trouble with a simple

Re: problem with shell script

2011-01-12 Thread Samuel Martín Moro
On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman wrote: > On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet wrote: > > > Hello > > > > I'm in trouble with a simple shell script that give > > erroneous value when running ... > > > > If I run commands int

Re: problem with shell script

2011-01-12 Thread Chad Kellerman
On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet wrote: > Hello > > I'm in trouble with a simple shell script that give > erroneous value when running ... > > If I run commands interactively everything runs well > > > ps ax | grep slapd | grep -v grep | wc -l >

problem with shell script

2011-01-12 Thread Frank Bonnet
Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well > ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the following shell script : #!/bin/sh SD=0 SD=`ps -ax | grep slapd | grep

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-09 Thread Oliver Fromme
Paul Lambert wrote: > Oliver Fromme wrote: > > Paul wrote: > > > Thanks Oliver > > > I can just get the i386 vmware version and should install and run. > > > Last question is there a x86_64 bit Linux module? > > > > No, unfortunately x86_64 linux binaries are not supported. > > > > > I

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-08 Thread Paul Lambert
Oliver, I was well on my way of installing VMware-Player for i386 linux on FreeBSD until I encountered these error messages. Aug 8 20:44:09 BRSINC-VM02 kernel: linux: pid 12889 (dd): ioctl fd=0, cmd=0x6d02 ('m',2) is not implemented Aug 8 20:44:09 BRSINC-VM02 kernel: linux: pid 12896 (dd): ioct

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-08 Thread Oliver Fromme
Paul wrote: > Thanks Oliver > I can just get the i386 vmware version and should install and run. > Last question is there a x86_64 bit Linux module? No, unfortunately x86_64 linux binaries are not supported. > Is one I'm development? I'm afraid I don't know. I suggest you try asking in th

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-07 Thread Paul
ime currently. > > Maybe someone else from the -questions list can jump in, > because I don't have much experience with vmware (I prefer > qemu or virtual box). > > Paul Lambert wrote: >> Thanks for the reply. I am attaching the bash output from the shell >> script.

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-07 Thread Oliver Fromme
e in the future. > > I previously had made the "stat" change to the shell script and that part > works. But, the bash shell is reporting an 'od" error. > > Finally, how much performance do you lose with the linux module emulator? Not much, probably none at

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-07 Thread Paul Lambert
e and find exactly where the code is located, > extract it and place it in the location where the shell script would place > and see if it will run from there. This is a longshot but the fact is shell > scripts automate what can be manually performed. But, using vi will be > tedious. Gedit wil

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-07 Thread Paul Lambert
. However, I can open the file and find exactly where the code is located, extract it and place it in the location where the shell script would place and see if it will run from there. This is a longshot but the fact is shell scripts automate what can be manually performed. But, using vi will be

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-06 Thread Paul Lambert
support. Paul On Fri, Aug 6, 2010 at 4:31 PM, Paul Lambert wrote: > Oliver, > > Thanks for the reply. I am attaching the bash output from the shell > script. This script implements RPMs so I am sure that I need the linux > module. I had previously found a guide on how to install

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-06 Thread Paul Lambert
Oliver, Thanks for the reply. I am attaching the bash output from the shell script. This script implements RPMs so I am sure that I need the linux module. I had previously found a guide on how to install RPMs on FreeBSD. I have a printer that has an RPM that allows it to work on Linus. So I

Re: misc/149335: shell script runs on Linux but not on freebsd

2010-08-06 Thread Oliver Fromme
Redirected to the -questions. Paul wrote: > What about matching the ' marks in this section? I get a command error. > > > > # XXX: put extraction in its own function > > > MAGIC_NUMBER=`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '` That command works fine for me: $ MAGIC_OFF

Re: check for numeric content in a shell script (FreeBSD sh)

2010-06-25 Thread parv
in message <20100624192256.gf...@libertas.local.camdensoftware.com>, wrote Chip Camden thusly... > > On Jun 24 08:39, Parv wrote: > > in message <20100624183407.ga49...@holstein.holy.cow>, > > wrote p...@pair.com thusly... > > > > > > # Matches a number, either positive (without '+' sign) or > > >

Re: check for numeric content in a shell script (FreeBSD sh)

2010-06-24 Thread Carl Johnson
p...@pair.com writes: >> if expr "$arg" : "[1-9]*\.\{0,1\}[0-9]*$" > /dev/null > > That regex considers "." a number but not "0.9" (this one seems to > be due to typo) nor a negative number. I had been pointing out an error in the regular expression that someone else had posted, but I obvious

Re: check for numeric content in a shell script (FreeBSD sh)

2010-06-24 Thread Chip Camden
On Jun 24 08:39, Parv wrote: > in message <20100624183407.ga49...@holstein.holy.cow>, > wrote p...@pair.com thusly... > > > > # Matches a number, either positive (without '+' sign) or > > # negative, which is either a whole number; or a real number > > # ending with decimal point, or a real numb

Re: check for numeric content in a shell script (FreeBSD sh)

2010-06-24 Thread Parv
in message <20100624183407.ga49...@holstein.holy.cow>, wrote p...@pair.com thusly... > > # Matches a number, either positive (without '+' sign) or > # negative, which is either a whole number; or a real number > # ending with decimal point, or a real number with or without > # leading digits be

Re: check for numeric content in a shell script (FreeBSD sh)

2010-06-24 Thread parv
in message <87d3vgmj1s@cjlinux.localnet>, wrote Carl Johnson thusly... > > Carl Johnson writes: > > > Carl Johnson writes: > > > >> vogelke+u...@pobox.com (Karl Vogel) writes: > >> > > On Thu, 24 Jun 2010 09:24:39 +0800, > > Aiza said: > >>> > >>> A> Receiving a variable from the com

Re: shell script to cap first letter?

2010-03-21 Thread Gary Kline
On Sun, Mar 21, 2010 at 10:16:22AM -0400, b. f. wrote: > >i'm wondering if there is a script that i could run my plaintext > >files thru that would capitalize thef first letter of each > >sentence [[ assuming the character wasn't already a cap!]] > > > >more and more, in recent years, i have posted

Re: shell script to cap first letter?

2010-03-21 Thread b. f.
>i'm wondering if there is a script that i could run my plaintext >files thru that would capitalize thef first letter of each >sentence [[ assuming the character wasn't already a cap!]] > >more and more, in recent years, i have posted questions or >written things that have been sloppily or casually

shell script to cap first letter?

2010-03-19 Thread Gary Kline
guys, i'm wondering if there is a script that i could run my plaintext files thru that would capitalize thef first letter of each sentence [[ assuming the character wasn't already a cap!]] more and more, in recent years, i have posted questions or written things that have been sloppily or casual

Re: Can a Bourn Shell Script put itself in the background?

2009-06-06 Thread Karl Vogel
>> "Barry Byrne" writes: B> I think the simplest thing would be to write a little wrapper script B> that calls your other script. B> B> #!/bin/sh B> echo "Stating Daemon Now" B> /path/to/mainscript & You might be better off using daemon to make sure you're detached from the controlling term

Re: Can a Bourn Shell Script put itself in the background?

2009-06-06 Thread Chris Rees
2009/6/6 Martin McCormick : > This also works in Linux's /bin/sh which I believe is an alias > for bash so occasionally little things work differently. > Usually is, but in some it's linked to dash. https://wiki.ubuntu.com/DashAsBinSh Also, you should ONLY use POSIX-compatible commands/extensio

Re: Can a Bourn Shell Script put itself in the background?

2009-06-06 Thread Martin McCormick
I really appreciate all the good suggestions I got from everybody who responded. "Barry Byrne" writes: > I think the simplest thing would be to write a little wrapper script, that > calls your other script. > > #!/bin/sh > > echo "Stating Daemon Now" > /path/to/mainscript & This got me

Re: Can a Bourn Shell Script put itself in the background?

2009-06-05 Thread Polytropon
On Fri, 5 Jun 2009 13:02:00 -0600, Chad Perrin wrote: > . . . or use tmux instead of GNU Screen, if you like. > > I got the impression this question was about a script backgrounding > itself, though -- possibly creating a daemon using bash. Maybe using detach (from ports) is a solution. It let's

Re: Can a Bourn Shell Script put itself in the background?

2009-06-05 Thread Karl Vogel
>> On Fri, 5 Jun 2009 13:02:00 -0600, >> Chad Perrin said: C> I got the impression this question was about a script backgrounding itself, C> though -- possibly creating a daemon using bash. Same here. This seems a bit slimy, but it works (assuming you don't already have an environment va

Re: Can a Bourn Shell Script put itself in the background?

2009-06-05 Thread relay.lists
= #!/bin/bash # This script will sleep # 50 times for 1 second in # the background main() { for ((i=0 ; i<=50 ;i++)) do sleep 1 let i++ done } main & # EOF == -- Best regards, Daniel __

Re: Can a Bourn Shell Script put itself in the background?

2009-06-05 Thread Chad Perrin
On Thu, Jun 04, 2009 at 09:29:30AM -0700, Nerius Landys wrote: > Just a thought, you can use the screen utility depending on what you > are trying to do. For example if you want to start a job, long out of > the machine completely, and then return to your job to see how it's > running, you may cho

Re: Can a Bourn Shell Script put itself in the background?

2009-06-04 Thread Nerius Landys
Just a thought, you can use the screen utility depending on what you are trying to do. For example if you want to start a job, long out of the machine completely, and then return to your job to see how it's running, you may choose to run screen. > screen bash (Press Control-A then d) (Logout from

RE: Can a Bourn Shell Script put itself in the background?

2009-06-04 Thread Barry Byrne
> > So, can I make a shell script background itself after > starting? > > Right now, I remind my coworkers to append the & after the > script name. the bg command expects a job number, not a process > ID. Martin, If you mean you'd like to be able to put a scr

Re: Can a Bourn Shell Script put itself in the background?

2009-06-04 Thread Nikos Vassiliadis
Martin McCormick wrote: So, can I make a shell script background itself after starting? You could run all your code in a sub-shell: #!/bin/sh ( #your script here ) & or in a shell function: old_script() { #your script here } old_script $* & Perhaps the se

Can a Bourn Shell Script put itself in the background?

2009-06-04 Thread Martin McCormick
I tried bg $$ but $$ is the current process invoked just as $! is the process of a backgrounded process started by that shell. So, can I make a shell script background itself after starting? Right now, I remind my coworkers to append the & after the script name. the bg command exp

Re: shell script port

2009-06-02 Thread Frank Shute
On Tue, Jun 02, 2009 at 07:42:56PM +0200, Stefan Miklosovic wrote: > > Hi, Hi Stefan, > > > > If you don't fancy porting it yourself, I'd be happy to have a go at > > porting it for you. > > > > I want to port a more complex piece of software to FreeBSD but I > > wouldn't mind starting on a sim

Re: restart rsync process via shell script

2008-12-29 Thread Noah
Mel wrote: On Monday 29 December 2008 13:35:06 Noah wrote: Hi there, I am trying to figure out the most accurate way to assess if an rsync process is running and is established to the remote rsync server and is transferring data. I am writing a bourne shell script to restart rsync if the

Re: restart rsync process via shell script

2008-12-29 Thread Mel
On Monday 29 December 2008 13:35:06 Noah wrote: > Hi there, > > I am trying to figure out the most accurate way to assess if an rsync > process is running and is established to the remote rsync server and is > transferring data. I am writing a bourne shell script to restart

restart rsync process via shell script

2008-12-29 Thread Noah
Hi there, I am trying to figure out the most accurate way to assess if an rsync process is running and is established to the remote rsync server and is transferring data. I am writing a bourne shell script to restart rsync if the connection to the remote rsync server is lost. The command &qu

Re: OT: Shell Script using Awk

2008-11-02 Thread Jonathan McKeown
On Sunday 02 November 2008 03:21:55 David Allen wrote: > My apologies for asking on this list, but I'm stuck without Perl and need > to use awk to generate a report. > > I'm working with a large data set spread across multiple files, but to > keep things simple, say I have A Very Long String that c

Re: OT: Shell Script using Awk

2008-11-02 Thread Josh Paetzel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David Allen wrote: > On 11/1/08, Sahil Tandon <[EMAIL PROTECTED]> wrote: >> David Allen <[EMAIL PROTECTED]> wrote: >> >>> My apologies for asking on this list, but I'm stuck without Perl and need >>> to use awk to generate a report. >>> >>> I'm working

Re: OT: Shell Script using Awk

2008-11-01 Thread David Allen
On 11/1/08, Sahil Tandon <[EMAIL PROTECTED]> wrote: > David Allen <[EMAIL PROTECTED]> wrote: > >> My apologies for asking on this list, but I'm stuck without Perl and need >> to use awk to generate a report. >> >> I'm working with a large data set spread across multiple files, but to >> keep things

Re: OT: Shell Script using Awk

2008-11-01 Thread David Allen
On 11/1/08, Gary Newcombe <[EMAIL PROTECTED]> wrote: > On Sat, 1 Nov 2008 18:21:55 -0700, "David Allen" > <[EMAIL PROTECTED]> wrote: > >> My apologies for asking on this list, but I'm stuck without Perl and need >> to use awk to generate a report. >> >> I'm working with a large data set spread acro

Re: OT: Shell Script using Awk

2008-11-01 Thread Sahil Tandon
David Allen <[EMAIL PROTECTED]> wrote: > My apologies for asking on this list, but I'm stuck without Perl and need > to use awk to generate a report. > > I'm working with a large data set spread across multiple files, but to > keep things simple, say I have A Very Long String that containing reco

Re: OT: Shell Script using Awk

2008-11-01 Thread Gary Newcombe
On Sat, 1 Nov 2008 20:17:54 -0800, "David Allen" <[EMAIL PROTECTED]> wrote: > On 11/1/08, Jeremy Chadwick <[EMAIL PROTECTED]> wrote: > > On Sat, Nov 01, 2008 at 06:21:55PM -0700, David Allen wrote: > >> My apologies for asking on this list, but I'm stuck without Perl and need > >> to use awk to ge

Re: OT: Shell Script using Awk

2008-11-01 Thread Gary Newcombe
On Sat, 1 Nov 2008 18:21:55 -0700, "David Allen" <[EMAIL PROTECTED]> wrote: > My apologies for asking on this list, but I'm stuck without Perl and need > to use awk to generate a report. > > I'm working with a large data set spread across multiple files, but to > keep things simple, say I have A

Re: OT: Shell Script using Awk

2008-11-01 Thread Jeremy Chadwick
On Sat, Nov 01, 2008 at 08:17:54PM -0800, David Allen wrote: > On 11/1/08, Jeremy Chadwick <[EMAIL PROTECTED]> wrote: > > On Sat, Nov 01, 2008 at 06:21:55PM -0700, David Allen wrote: > >> My apologies for asking on this list, but I'm stuck without Perl and need > >> to use awk to generate a report.

Re: OT: Shell Script using Awk

2008-11-01 Thread David Allen
On 11/1/08, Jeremy Chadwick <[EMAIL PROTECTED]> wrote: > On Sat, Nov 01, 2008 at 06:21:55PM -0700, David Allen wrote: >> My apologies for asking on this list, but I'm stuck without Perl and need >> to use awk to generate a report. >> >> I'm working with a large data set spread across multiple files

Re: OT: Shell Script using Awk

2008-11-01 Thread Jeremy Chadwick
On Sat, Nov 01, 2008 at 06:21:55PM -0700, David Allen wrote: > My apologies for asking on this list, but I'm stuck without Perl and need > to use awk to generate a report. > > I'm working with a large data set spread across multiple files, but to > keep things simple, say I have A Very Long String

OT: Shell Script using Awk

2008-11-01 Thread David Allen
My apologies for asking on this list, but I'm stuck without Perl and need to use awk to generate a report. I'm working with a large data set spread across multiple files, but to keep things simple, say I have A Very Long String that containing records, each delimited by a single space. I need to

Re: sudo multiple commands at once without shell script

2008-10-25 Thread Tom Marchand
oami ; whoami ) Badly placed ()'s. I could obviously write a shell script or something or do: sudo whoami; sudo whoami but is there a better way? -- We're just a Bunch Of Regular Guys, a collective group that's trying to understand and assimilate technology. We feel that

Re: sudo multiple commands at once without shell script

2008-10-25 Thread perryh
> How do I run multiple sudo commands at once? This fails > because the semicolon ends the whole sudo command: > > > sudo whoami; whoami > root > user > > This confuses tcsh: > > monica:~> sudo ( whoami ; whoami ) > Badly placed ()'s. Supposing sudo spawns a shell, something like ~> sudo whoami

sudo multiple commands at once without shell script

2008-10-25 Thread Kelly Jones
How do I run multiple sudo commands at once? This fails because the semicolon ends the whole sudo command: > sudo whoami; whoami root user This confuses tcsh: monica:~> sudo ( whoami ; whoami ) Badly placed ()'s. I could obviously write a shell script or something or do: > sud

Re: space char shell script problem

2008-08-24 Thread Derek Ragona
At 05:19 AM 8/23/2008, David Banning wrote: I am running into a problem with the space character in filenames. For instance, If I want to run the script; for x in `ls` do echo $x done then filenames that have a space in them ie: "john smith.jpg" are processed by my script as two names, "john"

Re: space char shell script problem

2008-08-23 Thread Matthew Seaman
Polytropon wrote: Well, it's completely possible to create a file name like: This is my *favourite* photo from "Cats" \ by Bob & Jane / my wife ~ 2008 `musical'.JPG Um... actually you cannot create that as a filename on UFS. There are precisely two characters you cannot use in a filename.

Re: space char shell script problem

2008-08-23 Thread Polytropon
On Sat, 23 Aug 2008 10:16:36 -0400, Thomas Dickey <[EMAIL PROTECTED]> wrote: > spaces won't go away, and since they're legal in filenames, one may as > well handle them. Well, it's completely possible to create a file name like: This is my *favourite* photo from "Cats" \ by Bob & Jane / my wife ~

  1   2   3   4   >