zhu的学习日记:shell脚本学习一(基础)

学海无涯,编程是岸 ------刚入门shell脚本的世界,希望记录下自己的每个脚印,积累才是进步

(shell脚本学习第一集:基础)

一、$符号的用意

$1        获取传进来的第一个参数

$2        获取传进来的第二个参数

$3        获取传进来的第三个参数

$#        一共多少个参数被传进来

$?       前一个命令是否正确执行

$$        获取本PID号

二、输出

1)echo xxx

2)printf xxx

三、双引号与单引号的区别

'xxx'去掉引号里面字符的特殊意义,比如\t是tab、\n是回车,在引号里面,单纯是斜杠+t,没有特殊意义

"xxx"单纯去掉空格,比如"a  b  c  d",其实就是"abcd"

四、数值比较

-eq       相等

-ne       不等

-gt       大于

-lt        小于

-ge      大于或等于

-le       小于或等于

-z        为空

-n        不为空

比如:

a大于b为【  $a -gt $b  】

五、判断

用[]来表示,并且里面的两端要空格,没有空格则是普通的文件名

比如:

[  $a = $b  ]表示判断a与b是否相等

[  $a -gt$b  ]表示判断是否a大于b

[$a -gt$b]表示普通字符串,因为两端没有空格

六、执行脚本

1)./build.sh,点为当前目录,build.sh为你要执行的脚本

2)/aa/bb/build.sh,表示执行aa目录里面的bb目录里面的build.sh脚本

七、文件判断

[   -e xxx   ]  判断xxx是否已经存在

[   -f xxx   ]  判断xxx是否是普通文件

[   -s xxx   ]  判断xxx是否大小为零

[   -d xxx   ]  判断xxx是否是一个目录

[   -r xxx   ]  判断xxx是否对当前用户可读取

[   -u xxx   ]  判断xxx是否对当前用户可写入

[   -x xxx   ]  判断xxx是否是可执行文件

[   -g xxx   ]  判断xxx的GID是否被设置

[   -u xxx   ]  判断xxx的VID是否被设置

[   -O xxx   ]  判断xxx是否属于当前用户

八、条件与判断

if语句:以if开始,以fi结束

if[   $a = bb   ]

      then  echo hello

      elif[   $a = cc   ]

      then  echo hi

      else

                echo nonono

fi

switch语句:以case开始,以esac结束

case  $a  in

               bb)

                      echo hello bb

                      ;;

               cc)

                      echo hello cc

                      ;;

               *)

                      echo helle other

esac

(后面那个*号就像是default一样)

for循环:

for  $a in 12   13   14

             do

                        echo $a

             done

(把12、13、14当作一个集合,然后遍历整个集合,并输出)

九、调试

执行的时候,用以下两个语句来操作

1)bash -v ./build.sh这个是执行的时候,可以看见具体现在走到了哪一步

2)bash -vx ./build.sh这个是执行的时候,不单止可以看到现在走到了哪一步,而且每一步都会把变量替换,并展示给你看


今天就学习到这,内容难免有错漏,待以后review,期待下一集




  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This exploratory paper quests for a stochastic and context sensitive grammar of images. The grammar should achieve the following four objectives and thus serves as a unified framework of representation, learning, and recognition for a large number of object categories. (i) The grammar represents both the hierarchical decompositions from scenes, to objects, parts, primitives and pixels by terminal and non-terminal nodes and the contexts for spatial and functional relations by horizontal links between the nodes. It formulates each object category as the set of all possible valid configurations produced by the grammar. (ii) The grammar is embodied in a simple And–Or graph representation where each Or-node points to alternative sub-configurations and an And-node is decomposed into a number of components. This representation supports recursive top-down/bottom-up procedures for image parsing under the Bayesian framework and make it convenient to scale up in complexity. Given an input image, the image parsing task constructs a most probable parse graph on-the-fly as the output interpretation and this parse graph is a subgraph of the And–Or graph after * Song-Chun Zhu is also affiliated with the Lotus Hill Research Institute, China. making choice on the Or-nodes. (iii) A probabilistic model is defined on this And–Or graph representation to account for the natural occurrence frequency of objects and parts as well as their relations. This model is learned from a relatively small training set per category and then sampled to synthesize a large number of configurations to cover novel object instances in the test set. This generalization capability is mostly missing in discriminative machine learning methods and can largely improve recognition performance in experiments. (iv) To fill the well-known semantic gap between symbols and raw signals, the grammar includes a series of visual dictionaries and organizes them through graph composition. At the bottom-level the dictionary is a set of image primitives each having a number of anchor points with open bonds to link with other primitives. These primitives can be combined to form larger and larger graph structures for parts and objects. The ambiguities in inferring local primitives shall be resolved through top-down computation using larger structures. Finally these primitives forms a primal sketch representation which will generate the input image with every pixels explained. The proposal grammar integrates three prominent representations in the literature: stochastic grammars for composition, Markov (or graphical) models for contexts, and sparse coding with primitives (wavelets). It also combines the structure-based and appearance based methods in the vision literature. Finally the paper presents three case studies to illustrate the proposed grammar.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值