Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer > Re: ksh scripti...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 992 of 1040
Post > Topic >>

Re: ksh scripting problem

by Robert Peirce <bob@[EMAIL PROTECTED] > Feb 8, 2008 at 04:05 PM

In article <bob-FA4A41.10151308022008@[EMAIL PROTECTED]
>,
 Robert Peirce <bob@[EMAIL PROTECTED]
> wrote:

> Does anybody have any idea why this works:
> 
> IFS='   '
> exec 0< "db/s.d"
> while read line
> do
>         set $line
>         if      (($3>0)) && ((${15}<16))
>         then
> 
> And this doesn't?
> 
> exec 0< "s.p"
> while read line
> do
>         set $line
>         ((++wkcnt))
>         if      (($1>0))   [>0: arithmetic syntax error]
>         then

Abject apologies for rank stupidity.  Each line in the s.p file ends 
with \r\n instead of just \n.  It is necessary to replace "set $line" 
with something like p=$(print $line | tr -d '\r').  Then ((p>0)) works 
fine.

The \r crap is a holdover from Windows.

-- 
Robert B. Peirce, Venetia, PA  724-941-6883
bob AT peirce-family.com [Mac]
rbp AT cooksonpeirce.com [Office]
 




 4 Posts in Topic:
ksh scripting problem
Robert Peirce <bob@[EM  2008-02-08 15:15:13 
Re: ksh scripting problem
Robert Peirce <bob@[EM  2008-02-08 16:05:51 
Re: ksh scripting problem
Robert Peirce <bob@[EM  2008-02-08 16:53:31 
Re: ksh scripting problem
Robert Peirce <bob@[EM  2008-02-08 18:41:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 9:33:50 CST 2008.