如何从rails上的字符串ruby中删除双引号? 我有一个字符串:
"5,5"
转换逻辑:
@a = @cart_id.chomp(',')
abort @a.inspect
答案 0 :(得分:1)
#! /bin/bash
export ORACLE_HOME=<YOUR_HOME>
export ORACLE_BIN=$ORACLE_HOME/bin/
DATABASE_ROLE() {
export ORACLE_SID=$1
request='SELECT DATABASE_ROLE FROM V$DATABASE'
result=`$ORACLE_BIN/sqlplus -silent / as sysdba << EOF
set pages 0 feedback off
${request};
exit
EOF`
echo ${result}
}
for DBNAME in DB1 DB2 DB3
do
$ORACLE_BIN/lsnrctl status LISTENER_${DBNAME}_FO > /dev/null
return_status=$?
if [ "$(DATABASE_ROLE ${DBNAME})" != 'PRIMARY' ];then
echo "DB ${DBNAME} is secondary"
if [ $return_status -eq 0 ];then
$ORACLE_BIN/lsnrctl stop LISTENER_${DBNAME}_FO
fi
else
echo "DB ${DBNAME} is primary"
if [ $return_status -eq 1 ];then
$ORACLE_BIN/lsnrctl start LISTENER_${DBNAME}_FO
fi
fi
done