~ubuntu-branches/ubuntu/precise/grass/precise

« back to all changes in this revision

Viewing changes to scripts/v.db.addtable/v.db.addtable

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-04-13 17:08:41 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110413170841-ss1t9bic0d0uq0gz
Tags: 6.4.1-1
* New upstream version.
* Now build-dep on libjpeg-dev and current libreadline6-dev.
* Removed patch swig: obsolete.
* Policy bumped to 3.9.2, without changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
 
57
57
# save command line
58
58
if [ "$1" != "@ARGS_PARSED@" ] ; then
59
 
    CMDLINE="`basename $0`"
 
59
    CMDLINE=`basename "$0"`
60
60
    for arg in "$@" ; do
61
61
        CMDLINE="$CMDLINE \"$arg\""
62
62
    done
64
64
    exec g.parser "$0" "$@"
65
65
fi
66
66
 
67
 
PROG=`basename $0`
 
67
PROG=`basename "$0"`
68
68
 
69
69
#### check if we have awk
70
70
if [ ! -x "`which awk`" ] ; then
116
116
# check if DB parameters are set, and if not set them.
117
117
db.connect -c
118
118
 
119
 
#check if anything is connected:
120
 
v.db.connect map="$GIS_OPT_MAP" -g  2> /dev/null | grep '^1 ' > /dev/null
 
119
#check if anything is connected to layer 1:
 
120
v.db.connect map="$GIS_OPT_MAP" -gl layer=1  2> /dev/null | grep -w '^1' > /dev/null
121
121
if [ $? -ne 0 ] ; then
122
122
   # nothing defined for layer 1
123
123
   g.message "Creating new DB connection based on default mapset settings..."
128
128
 
129
129
#maybe there is already a table linked to the selected layer?
130
130
if [ "$GIS_OPT_LAYER" -eq 1 ] ; then
131
 
  v.db.connect "$GIS_OPT_MAP" -g 2> /dev/null | grep -w "^$GIS_OPT_LAYER" > /dev/null
 
131
  v.db.connect "$GIS_OPT_MAP" -gl layer="$GIS_OPT_LAYER" 2> /dev/null | grep -w "^$GIS_OPT_LAYER" > /dev/null
132
132
  if [ $? -eq 0 ] ; then
133
133
     g.message -e "There is already a table linked to layer <$GIS_OPT_LAYER>" 
134
134
     exit 1