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
?出现了什么错误。没有错误,但值没有更改