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. Python基础:模块

    一.概述 二.导入语句 1.基本语法 2.推荐风格 三.模块 1.模块名 2.模块属性 3.可导出的公有属性 4.直接执行 四.包 1.包名 2.包属性 3.可导出的公有属性 4.其他 五.导入原理 ...

  2. windbg sos加载相关

    使用windbg 加载sos.dll时,经常碰到报The call to LoadLibrary(C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos.d ...

  3. .net xml 增删改查基础复习及干货分享

    今天做做项目时,有一个需求需要用到一些固定的文本数据,觉得将这些需要存储的信息直接写在代码里很不友好,放在数据库中存储又觉得不够方便,自然就想到了使用xml来进行操作,我平常在项目中其实用到xml的机 ...

  4. .NET向APNS苹果消息推送通知

    一.Apns简介: Apns是苹果推送通知服务. 二.原理: APNs会对用户进行物理连接认证,和设备令牌认证(简言之就是苹果的服务器检查设备里的证书以确定其为苹果设备):然后,将服务器的信息接收并且 ...

  5. 基础学习day10--异常、包

    一.异常 1.1.异常定义 异常:--不正常,程序在运行时出现不正常情况 异常由来:其实也是现实生活中一个具体的事物,马可以通过JAVA的类的形式表现描述,并封装成类. Java对不正常情况描述后的, ...

  6. 【转】Xcode托管代码到oschina中的教程

    本文的以下内容较旧,常常会出现第一次配置成功可以用,但关机重启后就一直提示“username or password”不正确的bug,所以建议弃ssh方式转向https方式,更加稳定.传送门:点我. ...

  7. IOS开发中(null)与<null>的处理

    不小心在开发过程中,得到了(null)以及<null>的返回值,找了好长时间只找到了一个关于<null>的. 由于要根据返回值进行判断,做出必要反应,因此必须知道返回值所代表的 ...

  8. UIWebView用法详解及代码分享

    今天我们来详细UIWebView用法.UIWebView是iOS内置的浏览器控件,可以浏览网页.打开文档等 能够加载html/htm.pdf.docx.txt等格式的文件. 用UIWebView我们就 ...

  9. Finder增强插件XtraFinder

    关于在Mac上安装XtraFinder插件,现在因为Mac更新到10.11, Mac OS X 10.11(El Capitan)默认开启了 SIP(System Integrity Protecti ...

  10. 《慕客网:IOS-动画入门》学习笔记

    新建Cocoa Touch Class,语言是swift 然后继续为界面添加一个普通的View Controller,并且添加前面视图的静态table的转向剪头指向这个View Controller, ...