LINUX BASH SHELL,小小学习一下
注意点要注意的:
整数运算一般通过 let 和 expr 这两个指令来实现,如对变量 x 加 1 可以写作:let "x = $x + 1" 或者 x=`expr $x + 1`
两个比较表格要记得:
对应的操作 |
整数操作 |
字符串操作 |
相同 |
-eq |
= |
不同 |
-ne |
!= |
大于 |
-gt |
> |
小于 |
-lt |
< |
大于或等于 |
-ge |
|
小于或等于 |
-le |
|
为空 |
-z |
|
不为空 |
-n |
运算符 |
含义( 满足下面要求时返回 TRUE ) |
-e file |
文件 file 已经存在 |
-f file |
文件 file 是普通文件 |
-s file |
文件 file 大小不为零 |
-d file |
文件 file 是一个目录 |
-r file |
文件 file 对当前用户可以读取 |
-w file |
文件 file 对当前用户可以写入 |
-x file |
文件 file 对当前用户可以执行 |
-g file |
文件 file 的 GID 标志被设置 |
-u file |
文件 file 的 UID 标志被设置 |
-O file |
文件 file 是属于当前用户的 |
-G file |
文件 file 的组 ID 和当前用户相同 |
file1 -nt file2 |
文件 file1 比 file2 更新 |
file1 -ot file2 |
文件 file1 比 file2 更老 |
#!/bin/bash #This is a very simple example STR="Hello , World!" echo $STR echo "$STR" echo '$STR' echo ${STR} x= let "x = $x + 1" echo $x x=`` echo $x x="olympic'"$x echo $x HELLO=Hello function hello { local HELLO=World echo $HELLO } echo $HELLO hello echo $HELLO ~
LINUX BASH SHELL,小小学习一下的更多相关文章
- Linux 下Shell的学习
1.Shell学习 1.什么是Shell shell是一个命令解析器,在操作系统的最外层,负责和用户对话,将用户的输入解释给操作系统,并处理各种各样的操作系统的输出结果.2.什么是shell脚本 ...
- linux BASH shell设置字体与背景颜色
linux BASH shell下设置字体及背景颜色的方法. BASH shell下设置字体及背景颜色 echo -e "\e[31mtest\e[41m" \e[30m 将字 ...
- Linux 下shell 编程学习脚手架
linux body { font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 1.6; padding-t ...
- 【Linux】linux bash shell之变量替换::=句法、=句法、:-句法、-句法、=?句法、?句法、:+句法、+句法
linux bash shell之变量替换::=句法.=句法.:-句法.-句法.=?句法.?句法.:+句法.+句法 linux bash shell之变量替换::=句法.=句法.:-句法.-句法. ...
- Linux Bash Shell常用快捷键
Linux Bash Shell常用快捷键 table { margin: auto } 快捷键 功能 tab 补全 ctrl + a 光标回到命令行首 ctrl + e 光标回到命令行尾 ctrl ...
- Linux bash shell All In One
Linux bash shell All In One Linux https://tinylab.gitbooks.io/shellbook/content/zh/chapters/01-chapt ...
- linux bash shell & lsof & grep & ps
linux bash shell & lsof & grep & ps lsof list all open files # lsof & grep $ lsof -P ...
- Linux之bash shell的学习
1.什么是bash shell bash 是Bourne Again Shell的简称,是从unix系统中的sh发展而来,是用户和偶Linux内核交互的工具,用户通过bash操作内核完成系统的使用和 ...
- linux bash shell 流程控制(if/else )
本文转自:http://blog.csdn.net/flowingflying/article/details/5069646 本文也即<Learning the bash Shell>3 ...
- (转)linux bash shell 入门教程
Shell Script(bash)简介 众所皆知地,UNIX上以小工具著名,利用许多简单的小工具,来完成原本需要大量软体开发的工作,这一点特色,使得UNIX成为许多人心目中理想的系统平台. 在众多的 ...
随机推荐
- mvc与mvvm
mvc:被动型式的,也就是说,只有view有要求的时候,控制器才有反应 View Controller Model 可以把一个页面看作是由多个view组成 Controller控制 ...
- 体验Impress.js
用腻了ppt,prezi的风格看起来更酷一点儿,无意中得知有Impress.js这么一个H5版的prezi,nice,值得一试. 关于Impress.js,网上教程很多,但说实话就跟教小朋友一样,一步 ...
- BestCoder冠军赛 - 1009 Exploration 【Tarjan+并查集缩点】
[题意] 给一个图,这个图中既有有向边,又有无向边,每条边只能走一次,问图中是否存在环. 最多10^6个点,10^6个无向边,10^6个有向边 [题解] 因为既有有向边又有无向边,所以不能单纯的用ta ...
- codevs 1993 草地排水 USACO
/*Dinic*/ #include<iostream> #include<cstdio> #include<cstring> #include<queue& ...
- 新闻web小酌
首页如上 类图如下: 添加新闻的方法(dao): public boolean Add(News news) { boolean flag=false; Connection con =getConn ...
- 错误记录--关于foreach,集合已修改;可能无法执行枚举操作
集合已修改,可能无法执行枚举操作.今天在使用foreach遍历的时候出现了这样的错误.查了一下,这个是使用foreach的典型的错误问题问题.foreach在遍历取数据的过程中,枚举器只允许读,不允许 ...
- Bootstrap Modal 框 alert confirm loading
/** * Created by Administrator on 2016/5/4. */ /** * 模态窗口 */ window.Modal = { tpls:{ alert:'<div ...
- ajax请求aspx页面
首先,这么用是不好的.最好用ashx,但也难免遇到这种需求.开发过这么一个系统,每天访问量最多100,web服务器压力很小,完全大马拉小车,主要压力都在数据库服务器上,要做大量的统计.所以页面直接全上 ...
- ASP.NET的WebConfig
转:http://blog.csdn.net/q3498233/article/details/8137364 WebConfig 花了点时间整理了一下ASP.NET Web.config配置文件的基 ...
- SVN global ignore pattern for c#
*.resharperoptions Web_Data log */[Bb]in [Bb]in */obj obj */TestResults TestResults *.svclog Debug ...