我正在尝试使用以下行运行源代码来编辑Informix中的数据库:drop table if exists tablename;
但是我收到一条错误消息:drop:command not found
我正在尝试使用以下行运行源代码来编辑Informix中的数据库:drop table if exists tablename;
但是我收到一条错误消息:drop:command not found
#!/bin/bash
export PATH=$PATH:.
#UTC
dt="2016-09-01 00:00:00.00000"
# dt=`date -u +"%Y-%m-%d %H:%M:%S.00000"`
# non-UTC
# dt=`date +"%Y-%m-%d %H:%M:%S.00000"`
echo ""
echo "Building DB"
dbaccess sysmaster - <<EOF1
drop database if exists iot;
create database iot in datadbs1 with buffered log ;
EOF1
echo ""
echo "Building row types, tables, and other objects" dbaccess iot -
drop table if exists sensors;
drop table if exists sensors_vti;
...
你不能在bash中使用db命令(直接)
drop table if exists sensors;
drop table if exists sensors_vti;
你需要使用的格式是
dbaccess sysmaster - <<EOF
drop database if exists iot;
create database iot in datadbs1 with buffered log ;
EOF
或者
echo "drop database if exists iot;create database iot in datadbs1 with buffered log ;" | dbaccess sysmaster