文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > linux shell 备忘录
侵权投诉

linux shell 备忘录

============shell 特殊变量
PS1='cmd !> ' :命令行提示符,!是当前命令数

============系统环境
getconf

===========参数处理
getopts

==========作业控制
bg
fg
jobs
kill
stty tostop
suspend
wait
sleep
usleep
Ctrl-Z

nohup
trap

watch
true
script :Makes a typescript of a terminal session.
killall:The killall command cancels all processes that you started, except those producing the killall process.
=========shell 内置环境变量
$#
$-
$? Exit value of last executed command.
$$
$!
$0
$n
$*, $@ All arguments on command line ($1 $2 ...).

$_ Temporary variable; initialized to pathname of script or program being executed. Later, stores the last argument of previous command. Also stores name of matching MAIL file during mail checks.
HISTCMD The history number of the current command.
LINENO Current line number within the script or function.
OLDPWD Previous working directory (set by cd).
OPTARG Name of last option processed by getopts.
OPTIND Numerical index of OPTARG.
PPID Process number of this shell's parent.
PWD Current working directory (set by cd).
RANDOM[=n] Generate a new random number with each reference; start with integer n, if given.
REPLY Default reply, used by select and read.
SECONDS[=n] Number of seconds since the shell was started, or, if n is given, number of seconds + n since the shell started.


locale :Print report on current locale settings.

========比较符
-a file (file exists.)
-d file (file exists and is a directory.)
-h file (a symbolic link.)
-L file (a symbolic link.)
-p file (named pipe (fifo).
-S file (a socket.)
-b file (block special file.)
-c file (character special file.)

-G file (group is the effective group ID)

-g file (set-group-id bit is set)
-k file (sticky bit is set)
-u file (set-user-id bit is set)
-O file (owner is the effective user ID)

-s file (size greater than zero)
-r file (readable )
-w file (writable )
-x file (executable)

-t [n]

The open file descriptor n is associated with a terminal device; default n is 1.



f1 -ef f2 (Files f1 and f2 are linked (refer to same file).)
f1 -nt f2 (File f1 is newer than f2.)
f1 -ot f2 (File f1 is older than f2.)

string (string is not null.)
-n s1 (String s1 has nonzero length.)
-z s1 (String s1 has zero length.)
s1 = = s2 (s2 can be a wildcard pattern. )
s1 != s2 (s2 can be a wildcard pattern. )
s1 < s2 (Valid only within [[ ]] construct.)
s1 > s2 (Valid only within [[ ]] construct.)

-o opt

n1 -eq n2
n1 -ge n2
n1 -gt n2
n1 -le n2
n1 -lt n2
n1 -ne n2

! condition
condition1 -a condition2
condition1 && condition2
condition1 -o condition2
condition1 || condition2

========变量&&数组

set -A message hi there how are you today #数组赋值
${name[i]}
${name} Use element 0 of array name.
${name[*]}
${name[@]}
${#name[*]}
${#name[@]}

${var}
${var:-value} Use var if set; otherwise,

第1页

你可能喜欢

热门文档

相关文档

  • linux备忘

    linux shell 备忘录 3页 免费 linux 备忘录-文件&目录 暂无评价 3页 免费 linux 备忘录 - 网络服务 暂无评价 2页 免费 linux 备忘录-数据库-orac... 暂无...

  • linux_shell大全

    1. Linux 脚本编写基础 1.1 语法基本介绍 1.1.1 开头 程序必须以下面的行...1.1.2 注释 在进行 shell 编程时,以#开头的句子表示注释,直到这一行的结束...

  • Linux Shell(2)

    Linux Shell 编程初步(2) 编程初步(2) 主讲:马永亮 主讲: 前一章内容回顾 shell的发展过程和用途 的发展过程和用途 shell变量的设置和使用 变量的设置和使用 ...

  • linux Shell programming

    linux Shell programming_计算机软件及应用_IT/计算机_专业资料。Shell Programming Content 1. Shell 综述– 什么是 Shell? 为什么要用 Shell? 2. 创建和执行Shell...

  • linuxShell简介

    linuxShell简介_IT/计算机_专业资料。shell在操作系统中的作用及其基本功能shell...命令记忆 ? 使用cat /root/.bash_history可以查询本次登 录前曾经做过的指令...

  • Linux下Shell编程

    Linux下Shell编程简介刘桂海( 西安理工大学 计算机科学与工程学院,陕西 西安 710048) 内容安排综述篇 命令篇 变量篇 条件测试篇 控制结构篇 函数篇 2013-2-4 ...

  • linux_shell

    linux_shell_IT/计算机_专业资料。linux shell概念介绍,shell入门的好资料Linux Study 第一部分 ...1...

  • Linux_shell编程

    Linux_shell编程_IT/计算机_专业资料。介绍shell编程。Date: 5. March. 2006 NEUSOFT Institute of Information Technology, ChengDu 本章主要内容 1. Shell 简介 ...

  • Linux+shell

    Linux shell 脚本全面学习 1.Linux 脚本编写基础 1.1 语法基本介绍 1.1.1 开头 程序必须以下面的行开始(必须方在文件的第一行): #!/bin/sh 符号#!用来...

  • Linux Shell简介

    Linux Shell简介_计算机软件及应用_IT/计算机_专业资料。LINUX SHELLShell...(没有设置的话,是'localhost')、当前所在的目 录(working directory)、提示...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email