sometimes you will write shell in windows platform, be careful for this, adjust the notepad plus plus information.

/etc/profile
A global configuration script that applies to all users.

~/.bash_profile
A user's personal startup file. Can be used to extend or override settings in the global configuration script.

~/.bashrc
A user's personal startup file. Can be used to extend or override settings in the global configuration script.

command << token
content to be used as command's standard input token

command >>file.txt command >file.txt ,pipe redirect the content to file.

>> append to the file >overwrite the file

Assigning A Command's Result To A Variable

You can also assign the results of a command to a variable:

right_now=$(date +"%x %r %Z")

Constants

IFS=$’\n’

Exit Status

Commands (including the scripts and shell functions we write) issue a value to the system when they terminate, called an exit status. This value, which is an integer in the range of 0 to 255, indicates the success or failure of the command’s execution. By convention, a value of zero indicates success and any other value indicates failure.

Expression

d file

True if file is a directory.

-e file

True if file exists.

-f file

True if file exists and is a regular file.

exit

In order to be good script writers, we must set the exit status when our scripts finish.

exit 0

exit 1

Positional parameters are a series of special variables ($0 through $9) that contain the contents of the command line.

Linux shell misc的更多相关文章

  1. Linux Shell中单引号、双引号、反引号的区别【转载】

    linux shell可以识别4种不同类型的引字符号: 单引号字符' 双引号字符" 反斜杠字符\ 反引号字符` 1. 单引号 ( '' )# grep Susan phonebook Sus ...

  2. linux shell 中的sleep命令

    开始还以为是这样的语法: sleep(1), 后面发现是: linux shell 中的sleep命令 分类: LINUX 在有的shell(比如linux中的bash)中sleep还支持睡眠(分,小 ...

  3. Linux shell脚本编程(三)

    Linux shell脚本编程 流程控制: 循环语句:for,while,until while循环: while CONDITION; do 循环体 done 进入条件:当CONDITION为“真” ...

  4. Linux shell脚本编程(二)

    Linux shell脚本编程(二) 练习:求100以内所有偶数之和; 使用至少三种方法实现; 示例1: #!/bin/bash # declare -i sum=0 #声明一个变量求和,初始值为0 ...

  5. Linux shell脚本编程(一)

    Linux shell脚本编程: 守护进程,服务进程:启动?开机时自动启动: 交互式进程:shell应用程序 广义:GUI,CLI GUI: CLI: 词法分析:命令,选项,参数 内建命令: 外部命令 ...

  6. Linux Shell 流程控制语句

    * 本文主要介绍一些Linux Shell 常用的流程控制语句* 1. if 条件语句:if-then/if-elif-fi/if- else-fi if [条件判断逻辑1];then command ...

  7. Linux Shell 截取字符串

    Linux Shell 截取字符串 shell中截取字符串的方法很多 ${var#*/} ${var##*/} ${var%/*} ${var%%/*} ${var:start:len} ${var: ...

  8. Linux Shell 重定向与管道【转帖】

    by 程默 在了解重定向之前,我们先来看看linux 的文件描述符. linux文件描述符:可以理解为linux跟踪打开文件,而分配的一个数字,这个数字有点类似c语言操作文件时候的句柄,通过句柄就可以 ...

  9. Linux Shell 通配符、元字符、转义符【转帖】

    作者:程默 说到shell通配符(wildcard),大家在使用时候会经常用到.下面是一个实例: 1   1 2 3 4 [chengmo@localhost ~/shell]$ ls a.txt  ...

随机推荐

  1. 进入IT企业必读的200个.NET面试题

    点击打开链接 点击打开链接 版权声明:本文为博主原创文章,未经博主允许不得转载.

  2. yyyy/M/d h:m:s 转换成 yyyy-MM-dd hh:mm:ss

    var arrTime = (dtime).replace("/", "-").replace("/", "-"); v ...

  3. AssemblyInfo文件

    程序生成版本信息 AssemblyInfo.cs主要用来设定生成的有关程序集的常规信息dll文件的一些参数 请看以下具体说明: //备注:  [assembly:AssemblyDescription ...

  4. javascript: jquery.gomap-1.3.3.js

    from:http://www.pittss.lv/jquery/gomap/solutions.php jquery.gomap-1.3.3.js: /** * jQuery goMap * * @ ...

  5. 一个小笔记(7):EN_1

    For nearly ten years, the Unified Modeling Language(UML) has been the industry standard for visualiz ...

  6. PHP学习笔记:APACHE配置虚拟目录、一个站点使用多域名配置方式

    我用的是xmapp lite2016的集成包,配置虚拟目录教程如下: 找到httpd-vhosts.conf这个文件,这个文件一般是在xampp\apache\conf\extra这个路径下面,找不到 ...

  7. Virtual Environments for mac

    A Virtual Environment is a tool to keep the dependencies required by different projects in separate ...

  8. javascript中静态方法、实例方法、内部方法和原型的一点见解

    1.静态方法的定义 var BaseClass = function() {}; // var BaseClass=new Function(); BaseClass.f1 = function(){ ...

  9. SharePoint 2013 中代码创建列表查阅项字段

    1.首先,打开VS创建两个List Definition,分别是Address和City,如下图: 2.City列表里修改Title为City Name,其实内部名称还是Title,注意一下: 3.给 ...

  10. 【转】android shape的使用

    shape用于设定形状,可以在selector,layout等里面使用,有6个子标签,各属性如下: <?xml version="1.0" encoding="ut ...