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. 获取 Windows Phone 手机系统信息

    wpf: <phone:PhoneApplicationPage x:Class="ABSystemInfo.MainPage" xmlns="http://sch ...

  2. 【JS复习笔记】02 对象与函数

    好吧,因为很重要的事情,几天没写笔记了. 关于对象: ||可以用来填充默认值,如:myApp.name || "无" &&可以用来避免错误,myApp.NameOb ...

  3. 与众不同 windows phone (44) - 8.0 位置和地图

    [源码下载] 与众不同 windows phone (44) - 8.0 位置和地图 作者:webabcd 介绍与众不同 windows phone 8.0 之 位置和地图 位置(GPS) - Loc ...

  4. ruby on rails 2.3+的版本不再支持cgi

    ruby on rails 2.3+的版本不再支持cgi了,恶心到了,换其他框架,看了款cramp,完全没资料,完全不让人入门 操蛋的厉害,ruby果然是小众的窝里乐,放弃使用

  5. CentOS6.5 FTP配置

    一:安装vsftpd 查看是否已经安装vsftpd rpm -qa | grep vsftpd 如果没有,就安装,并设置开机启动 yum -y install vsftpd chkconfig vsf ...

  6. 干净的停止tomcat/java应用程序

    通常在使用了jdbc或者netty的应用程序中,当shutdown tomcat或java应用程序时,会出现无法停止的情况,报类似如下错误: 严重: The web application [] re ...

  7. 我所了解的WEB开发 (1)

    开始接触网站开发的时候,概念里就对静态网站和动态网站有了简单的区分,静态网站仅仅是纯粹的HTML网页,动态网站是需要采用asp 连接数据库(比如access).那个时候听说高手都是使用 Notepad ...

  8. 使用CodeMirror在浏览器中实现编辑器的代码高亮效果

    使用CodeMirror在浏览器中实现编辑器的代码高亮效果 在网站后台管理中希望能够对网站的样式表css与js文件以及模板html进行管理,在编辑的时候只是以普通文本展示又太普通,显得好难看,于是便在 ...

  9. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q63-Q65)

    Question 63You have a SharePoint farm that has more than 100 custom Features.You upgrade several Fea ...

  10. android ButterKnife 解决重复findViewById

    简介: 程序员都是懒惰的,不想写一大堆像下面这样的代码 class ExampleActivity extends Activity { TextView title; TextView subtit ...