Re: OT: bash script - unexpected exit

2012-01-23 Thread Hiisi
for Fedora users" > Sent: Monday, January 16, 2012 3:34:37 PM > > Subject: Re: OT: bash script - unexpected exit > > On Mon, Jan 16, 2012 at 1:25 PM, Andre Speelmans > wrote: >> On Mon, Jan 16, 2012 at 8:55 PM, JD wrote: >>> What exactly were you trying to accom

Re: OT: bash script - unexpected exit

2012-01-17 Thread Matthew Mosesohn
Sorry about that. I meant to say that using for line in $(cat file) is bad because it might not split up into lines properly. - Original Message - From: "JD" To: "Community support for Fedora users" Sent: Monday, January 16, 2012 3:34:37 PM Subject:

Re: OT: bash script - unexpected exit

2012-01-16 Thread Frantisek Hanzlik
Andre Speelmans napsal(a): >> You shouldn't rely on cat or for to read a file line by line, but instead do >> this: >> >> while read line; do >> commands >> done < hosts > > I would pick this form myself, but why should one not rely on cat? It > seems to me a viable (even if useless use of cat)

Re: OT: bash script - unexpected exit

2012-01-16 Thread Dave Ihnat
On Mon, Jan 16, 2012 at 09:25:30PM +0100, Andre Speelmans wrote: > I was not trying, the OP had a script that did a: > cat file | while read line; do something done > > Matthew commented that you should not rely on cat for reading a file > line by line and I was curious as to why not. ... I'm not

Re: OT: bash script - unexpected exit

2012-01-16 Thread Cameron Simpson
On 16Jan2012 19:57, Hiisi wrote: | On 16 January 2012 20:50, Kevin Martin wrote: | > put a 'set -x' in there so you can see what's happening during the execution.  It would be interesting to know what $line is getting | > set to.  You may be surprised. | > | > Kevin | | Thanks for you help, Kev

Re: OT: bash script - unexpected exit

2012-01-16 Thread JD
On Mon, Jan 16, 2012 at 1:25 PM, Andre Speelmans wrote: > On Mon, Jan 16, 2012 at 8:55 PM, JD wrote: >> What exactly were you trying to accomplish using cat? > > I was not trying, the OP had a script that did a: > cat file | while read line; do something done > > Matthew commented that you should

Re: OT: bash script - unexpected exit

2012-01-16 Thread Andre Speelmans
On Mon, Jan 16, 2012 at 8:55 PM, JD wrote: > What exactly were you trying to accomplish using cat? I was not trying, the OP had a script that did a: cat file | while read line; do something done Matthew commented that you should not rely on cat for reading a file line by line and I was curious a

Re: OT: bash script - unexpected exit

2012-01-16 Thread JD
On Mon, Jan 16, 2012 at 11:27 AM, Andre Speelmans wrote: >> You shouldn't rely on cat or for to read a file line by line, but instead do >> this: >> >> while read line; do >>   commands >> done < hosts > > I would pick this form myself, but why should one not rely on cat? It > seems to me a viable

Re: OT: bash script - unexpected exit

2012-01-16 Thread Andre Speelmans
> You shouldn't rely on cat or for to read a file line by line, but instead do > this: > > while read line; do >   commands > done < hosts I would pick this form myself, but why should one not rely on cat? It seems to me a viable (even if useless use of cat) option. Is there something totally wron

Re: OT: bash script - unexpected exit

2012-01-16 Thread Matthew Mosesohn
: Monday, January 16, 2012 12:08:45 PM Subject: Re: OT: bash script - unexpected exit Never mind. I changed it to use for line in `cat hosts` and now it works. Sorry for the noise, list. Thanks for the tip, Kevin. That was fast! -- users mailing list users@lists.fedoraproject.org To unsubscribe

Re: OT: bash script - unexpected exit

2012-01-16 Thread Hiisi
On 16 January 2012 20:57, Hiisi wrote: > On 16 January 2012 20:50, Kevin Martin wrote: >> put a 'set -x' in there so you can see what's happening during the >> execution.  It would be interesting to know what $line is getting >> set to.  You may be surprised. >> >> Kevin > > Thanks for you help,

Re: OT: bash script - unexpected exit

2012-01-16 Thread Hiisi
On 16 January 2012 20:50, Kevin Martin wrote: > put a 'set -x' in there so you can see what's happening during the execution. >  It would be interesting to know what $line is getting > set to.  You may be surprised. > > Kevin Thanks for you help, Kevin. It doesn't display anything during first l

Re: OT: bash script - unexpected exit

2012-01-16 Thread Kevin Martin
On 01/16/2012 10:29 AM, Hiisi wrote: > Hi, list. > Sorry for OT. I like this list and really appreciate your help. Please > excuse me if this post irritates you. > I want to write a bash script that will do some work on a LAN. Here's > the script (at least I execute it on Fedora machine ): > #!/b

OT: bash script - unexpected exit

2012-01-16 Thread Hiisi
Hi, list. Sorry for OT. I like this list and really appreciate your help. Please excuse me if this post irritates you. I want to write a bash script that will do some work on a LAN. Here's the script (at least I execute it on Fedora machine ): #!/bin/sh set -e cat hosts | while read line do