0
這裏是我嘗試運行的shell腳本。它僅在作爲命令運行時運行,但在從腳本運行時出現錯誤。psql的bash腳本
#!/bin/bash
# sets CE IP addresses to act as LUS on pgsql
#Checks that user is logged in as root
if [ $(id -u) = "0" ]; then
#Asks user for IP of CE1
echo -n "Enter the IP address of your first CE's management module > "
read CE1
$(psql -U asm -d asm -t -c) echo """update zr_fsinstance set lu_order='1' where managementaccesspointhostname = '$CE1';"""
echo "LUS seetings have been completed"
else
#Warns user of error and sends status to stderr
echo "You must be logged in as root to run this script." >&2
exit 1
fi
以下是錯誤:
psql: option requires an argument -- 'c'
Try "psql --help" for more information.
update zr_fsinstance set lu_order='1' where managementaccesspointhostname = '10.134.39.139';
這就是我最終使用的命令:COMMAND = $'psql -U asm -d asm -t -c \「update zr_fsinstance set lu_order = \'1 \'其中managementaccesspointhostname = \''$ CE1 \'' ;「' echo $ COMMAND eval $ COMMAND –