我在Bash中有一个字符串:
string="My string"
Run Code Online (Sandbox Code Playgroud)
如何测试它是否包含另一个字符串?
if [ $string ?? 'foo' ]; then
echo "It's there!"
fi
Run Code Online (Sandbox Code Playgroud)
??我的未知运营商在哪里?我是否使用echo grep?
if echo "$string" | grep 'foo'; then
echo "It's there!"
fi
Run Code Online (Sandbox Code Playgroud)
这看起来有点笨拙.
该==运算符用于比较的shell脚本两个字符串.但是,我想比较两个忽略大小写的字符串,怎么做呢?这有什么标准命令吗?
可以这样做吗?
$ sqlplus -s user/pass "select 1 from dual"
要么
$ echo "select 1 from dual" | sqlplus -s user/pass
我知道我可以放入select 1 from dual文件并执行此操作:
$ sqlplus -s user/pass @myFile.sql
但我想知道是否真的有必要创建一个文件只是为了满足sqlplus