【发布时间】:2019-07-11 13:24:54
【问题描述】:
我正在尝试运行源代码以使用以下行在 Informix 中编辑数据库: 如果存在表名,则删除表;
但是我收到一条错误消息: 删除:找不到命令
我正在尝试运行源代码以使用以下行在 Informix 中编辑数据库: 如果存在表名,则删除表;
但是我收到一条错误消息: 删除:找不到命令
我是数据库和 Ubuntu 的新手,所以这对我来说不是直截了当的。请帮助如何解决这个问题。谢谢。
#!/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;
...
【问题讨论】:
-
@Simonare 诊断出正确的问题,您错误地编写了 drop table 命令,因为它们在 echo 之外。上面正确的最后一行是 ` echo "drop table if exists sensors" | dbaccess iot - echo "drop table if exists sensors_vti" | dbaccess iot -` 或它的变体。
标签: bash shell ubuntu informix heredoc