[Antelope] shell variables and dbsubset
Jonathan MacCarthy
jkmacc at nmt.edu
Sat Nov 29 14:44:12 CST 2008
Thank you, Jennifer & Kent! Worked perfectly. I apparently need to
brush up on my quoting.
Best,
Jonathan
On Nov 28, 2008, at 6:30 PM, Dr. Kent Lindquist wrote:
>
> Hello Jonathan,
>
> Try reversing the usage of single and double quotes. I believe the
> single quotes surrounding your subsetting expression are preventing
> variable interpolation by the shell:
>
> % ./ascript
> 4854 645 P21A P 9.99 2.566 241.82 59.79
> -0.320 d -999.0 - -999.00 - -999.0 -1.000 kyrghyz
> -1 1227921744.85690
> %
>
> % cat ascript
> #!/bin/sh
>
> STATION="P21A"
> dbsubset db.assoc "sta == '$STATION' " | dbselect -
> %
>
> Best regards,
> Kent
>
>
>
> On Nov 29, 2008, at 12:06 PM, Jonathan MacCarthy wrote:
>
>> Hello, all. I have a quick shell scripting question that I thought
>> would be easy to answer, but I haven't found anything yet.
>> I'm simply trying to substitute a shell variable into a dbsubset
>> call. Something like:
>>
>> #!/bin/sh
>>
>> STATION="P21A"
>> dbsubset db.assoc 'sta == "$STATION" ' > out.view
>>
>>
>>
>> ...I've tried all sorts of escapes, but dbsubset will have none of
>> them. Does anyone see what I'm doing wrong?
>>
>> Thank you in advance.
>>
>> Best,
>> Jonathan
>>
>>
>>
>> Jonathan MacCarthy
>> PhD Candidate in Seismology
>> New Mexico Institute of Mining and Technology
>> Dept. of Earth and Environmental Science, MSEC208
>> 801 Leroy Place
>> Socorro, NM 87801
>> ph: 505.835.5418
>> web: www.ees.nmt.edu/~jkmacc
>>
>> _______________________________________________
>> Antelope mailing list
>> Antelope at brtt.net
>> http://brtt.net/mailman/listinfo/antelope_brtt.net
>
> --
> Dr. Kent Lindquist kent at lindquistconsulting.com
> Lindquist Consulting, Inc.
> 59 College Rd. Suite #7
> Fairbanks, AK 99701 Phone/FAX 907-457-2374
>
> http://www.lindquistconsulting.com
>
> _______________________________________________
> Antelope mailing list
> Antelope at brtt.net
> http://brtt.net/mailman/listinfo/antelope_brtt.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://brtt.net/pipermail/antelope_brtt.net/attachments/20081129/4654f78e/attachment.html>
More information about the Antelope
mailing list