I'm writing a simple script to export postgis data to geojson. The ogr2ogr command works well, but I'm having problems when I'm passing the parameters.
#!/bin/bash
echo 'enter country code'
read export
echo 'exporting data from $export'
ogr2ogr -f GeoJSON export.geojson PG:'dbname=alamedaok user=postgres host=localhost' -sql "SELECT id_alameda, pais, geom FROM poblaciones_def WHERE pais = `$export`"
The problem comes in the WHERE pais = **
$export"**
I don't know how "insert" the variable in the sql sentence.
I've tried with '$' and with `, with no luck.
Any help?