[]with[[]]
[brand@localhost ~]$ echo $name hello
hello
[brand@localhost ~]$ [$name = "hello"]
-bash: [: missing `]' #[ ] 与变量要有间隔
[brand@localhost ~]$ [ $name = "hello" ]
-bash: [: =: unary operator expected# 包含$,分词影响
[brand@localhost ~]$ [[ $name = "hello" ]]
[brand@localhost ~]$ echo $? [brand@localhost ~]$ [[ "$name" = "hello" ]]
[brand@localhost ~]$ echo $? [brand@localhost ~]$ [ "$name" = "hello" ]
[brand@localhost ~]$ echo $? [brand@localhost ~]$
[]是shell内嵌的命令,会执行
[[]]是usr/bin/test
(( ))用于数字计算
随机推荐
- DSP using MATLAB 示例Example2.11
上代码: b = [1]; a = [1, -1, 0.9]; n = [-20:120]; h = impz(b,a,n); set(gcf,'Color','white'); %subplot(2 ...
- poj 2774 Long Long Message 后缀数组基础题
Time Limit: 4000MS Memory Limit: 131072K Total Submissions: 24756 Accepted: 10130 Case Time Limi ...
- server返回arraylist时,juqery在客户端的处理
首先,要添加命名控件如下: using System.Web.Services; server端的方法 [WebMethod()] public static ArrayList GetAuthB ...
- 三进制状压 HDOJ 3001 Travelling
题目传送门 题意:从某个点出发,所有点都走过且最多走两次,问最小花费 分析:数据量这么小应该是状压题,旅行商TSP的变形.dp[st][i]表示状态st,在i点时的最小花费,用三进制状压.以后任意进制 ...
- three.js 场景入门
<!DOCTYPE html> <html> <head> <title>Example 01.02 - First Scene</title&g ...
- WPF – pass multiple parameters to a Command
public class SendCommand : ICommand { public void Execute(object parameter) { var labels = ((object[ ...
- 使用Adobe Edge Inspect在各种设备中轻松测试同一页面
有过移动网站开发经历的开发者都知道,在各种设备中测试同一页面是一项非常繁琐的工作.现在,我们可以使用Adobe Edge Inspect来简化这一工作.如果使用Edge Inspect,可以在各种设备 ...
- background-attachment 定义背景图片随滚动轴的移动方式
- Codeforce - Travelling Salesman
After leaving Yemen, Bahosain now works as a salesman in Jordan. He spends most of his time travelli ...
- POJ-A Simple Problem with Integers
Description 给出了一个序列,你需要处理如下两种询问. "C a b c"表示给[a, b]区间中的值全部增加c (-10000 ≤ c ≤ 10000). " ...