Tag Info

Hot answers tagged


Try the following: #!/bin/bash read -p 'Enter country code: ' EXP echo "exporting data from $EXP" echo ogr2ogr -f GeoJSON export.geojson PG:'dbname=alamedaok user=postgres host=localhost' -sql "SELECT id_alameda, pais, geom FROM poblaciones_def WHERE pais = '$EXP'" Notes: read uses the -p parameter to set the prompt You used backquotes (``) in your SQL ...


Bash is particular about the quote characters `, ' and ". Use double quotes to substitute the variable in a string like "wonderful $VAR". Also with Bash, the convention is that variables are upper-case, and I'd avoid using export as a variable name since it is a command for environment variables. Consider these changes: #!/bin/bash read -p "enter country ...

Only top voted, non community-wiki answers of a minimum length are eligible