我正在使用SH shell,我正在尝试将字符串与变量的值进行比较,但if条件总是执行为true.为什么?
这是一些代码:
Sourcesystem="ABC"
if [ "$Sourcesystem" -eq 'XYZ' ]; then
echo "Sourcesystem Matched"
else
echo "Sourcesystem is NOT Matched $Sourcesystem"
fi;
echo Sourcesystem Value is $Sourcesystem ;
Run Code Online (Sandbox Code Playgroud)
即使这不起作用:
Sourcesystem="ABC"
if [ 'XYZ' -eq "$Sourcesystem" ]; then
echo "Sourcesystem Matched"
else
echo "Sourcesystem is NOT Matched $Sourcesystem"
fi;
echo Sourcesystem Value is $Sourcesystem ;
Run Code Online (Sandbox Code Playgroud)
其次,我们可以将它与NULL或空字符串匹配吗?
这工作正常:
$ echo email_{ldn,nyk,asp}.log
Run Code Online (Sandbox Code Playgroud)
同样,我想找到略有不同的文件名:
$ find ~ -type f -name email_{ldn,nyk,asp}.log
Run Code Online (Sandbox Code Playgroud)
但上面的命令会导致错误:
find: paths must precede expression: email_nyk.log
Run Code Online (Sandbox Code Playgroud)
任何有关 find 命令中大括号扩展的帮助将非常感激。
数据:我写了两个查询,一个是WITH而另一个是SELECT,然后自己加入下面的表,但两个查询返回不同的结果,为什么会发生?
表名是test_cur
ID_SOURCE_CUR ID_TARGET_CUR
------------- --------------
A B
B C
C D
D E
A Z
G A
K A
Q A
J J
K K
K L
L K
B A
Z A
Run Code Online (Sandbox Code Playgroud)
那么为什么以下两个查询会返回不同的结果?
SELECT *
FROM test_cur tu, test_cur fu
WHERE tu.id_target_cur = 'A'
AND fu.id_source_cur = 'A'
AND tu.id_source_cur <> fu.id_target_cur;
returns 8 rows.
ID_SOURCE_CUR ID_TARGET_CUR ID_SOURCE_CUR_1 ID_TARGET_CUR_1
-------------- -------------- -------------- --------------
G A A B
K A A B
Q A A B
Z A …Run Code Online (Sandbox Code Playgroud) 我想要一个正则表达式,它按字母顺序替换字符串及其各自的字符,包括数字:ie
我的意思是 :
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
0 1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1 0
几个例子:
1)ABC*1230 - …