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: 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 ~

Re: space char shell script problem

2008-08-23 Thread Thomas Dickey
On Sat, Aug 23, 2008 at 04:09:57PM +0200, Polytropon wrote: > On Sat, 23 Aug 2008 06:19:42 -0400, David Banning <[EMAIL PROTECTED]> 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 $

Re: space char shell script problem

2008-08-23 Thread Polytropon
On Sat, 23 Aug 2008 06:19:42 -0400, David Banning <[EMAIL PROTECTED]> 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

Re: space char shell script problem

2008-08-23 Thread Robert Huff
RW writes: > > 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 > > for x in * There's the (poorly documented, IMO) IFS (internal field separator) shell variabl

Re: space char shell script problem

2008-08-23 Thread RW
On Sat, 23 Aug 2008 06:19:42 -0400 David Banning <[EMAIL PROTECTED]> 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 for x in * ___ freeb

space char shell script problem

2008-08-23 Thread David Banning
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" and "smith.jpg". What is the best way to dea

Re: OT: shell script problem

2003-02-21 Thread Grzegorz Czaplinski
On Thu, Feb 20, 2003 at 03:14:22PM -0600, Brian Henning wrote: > i have this script with one input file and i keep getting the error: > /files_???/19980527/???/myname # sh doc_id.sh input.txt > /files_???/19980527/???/: No such file or directory > /files_???/19980527/???/ > > sh doc_i

OT: shell script problem

2003-02-20 Thread Brian Henning
i have this script with one input file and i keep getting the error: /files_???/19980527/???/myname # sh doc_id.sh input.txt /files_???/19980527/???/: No such file or directory /files_???/19980527/???/ sh doc_id.sh - #! /bin/sh -x INPUT=$1 for i in `cat $INPUT`; do