Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 更新查询在脚本中不起作用_Bash_Sqlite_Sh - Fatal编程技术网

Bash 更新查询在脚本中不起作用

Bash 更新查询在脚本中不起作用,bash,sqlite,sh,Bash,Sqlite,Sh,我想更新所选客户状态为活动的“非活动”客户值,我尝试过这样做,但它不会更新所选客户的“非活动”。任何人有什么想法请告诉我。塔克斯 #!/bin/bash echo " --- Enter the Database name ---" #name of the database read databasename echo " --- enter the table name --- " #name of the table read table_name sqlite3 $database

我想更新所选客户状态为活动的“非活动”客户值,我尝试过这样做,但它不会更新所选客户的“非活动”。任何人有什么想法请告诉我。塔克斯

#!/bin/bash

echo " --- Enter the Database name ---" #name of the database
read databasename

echo " --- enter the table name --- " #name of the table
read table_name

sqlite3 $databasename.db $table_name;

sqlite3 $databasename.db "select * from $table_name WHERE cus_status = 'Active';"

echo "---Select the domain to make Inactive---"
read inactive_user


sqlite3 $databasename.db  "UPDATE $table_name SET cus_status = 'Inactive' WHERE cus_name = $inactive_user $table_name";


sqlite3 $databasename.db "select * from $table_name";

检查列的数据类型
cus\u name
。我假设它是
varchar
。 因此,您可以尝试使用
而不是
$inactive\u user'


“更新$table\u name SET cus\u status='Inactive',其中cus\u name='Inactive\u user'$table\u name;”

尝试将$Inactive\u user放入单个quotessqlite3$databasename.db“更新$table\u name SET cus\u status='Inactive',其中cus\u name='Inactive';不工作为什么在SQL update查询结束时重复
$table\u name
?出现了什么错误。没有错误,但值没有更改