[Antelope] shell variables and dbsubset
Dr. Kent Lindquist
kent at lindquistconsulting.com
Fri Nov 28 19:30:56 CST 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://brtt.net/pipermail/antelope_brtt.net/attachments/20081129/364e798e/attachment-0001.html>
More information about the Antelope
mailing list