开始学习Shell脚本。

#!/bin/bash

if [ $UID -ne  ]; then
echo "you are not root"
else
echo "you are root"
fi var="hello world"
echo $var
echo ${var}
echo "var is $var"
echo 'var is $var'
echo "length of var is ${#var}"

注意点:

  1. var="hello world",等号两边不要有空格。

  2. 变量替换在单引号中无效。

参考资料:

《Linux Shell 脚本攻略》

最新文章

  1. 常用js代码集
  2. 5.首次登陆与在线求助man page
  3. [转]Amazon DynamoDB – a Fast and Scalable NoSQL Database Service Designed for Internet Scale Applications
  4. C语音常用库和函数
  5. Python访问剪切板
  6. git常用命令表
  7. 【Go语言】I/O专题
  8. Linux内核知识
  9. 小技巧:SystemTray中进行操作提示
  10. nodejs child process
  11. Error message “Assembly must be registered in isolation” when registering Plugins in Microsoft Dynamics CRM 2011 2013 解决办法
  12. Jasper_sheetName_defined by parameter or hard coding or filed name
  13. QT IP输入框正则表达式(使用QLineEdit的setValidator函数)
  14. SQL Server 有关EXCEPT和INTERSECT使用
  15. Core Animation中的基础动画
  16. JavaScript获取html元素的实际宽度和高度
  17. Python logging 模块和使用经验
  18. CSS后代选择器“空格”和“>”的使用辨析
  19. 基于Cloudera Search设计数据灾备方案
  20. MySQL的自动提交模式

热门文章

  1. String 对象-->split() 方法
  2. CopyOnWriteArrayList线程安全的集合
  3. python初学(二)
  4. 【Java】Junit单元测试
  5. L17 AlexNet VGG NiN GoogLeNet
  6. Sprint 3 : oxford project API 尝试
  7. 常见web漏洞整理之进击吧xss!!!
  8. 初始化 RESTful API 风格的博客系统
  9. sql注入原理+mysql相关知识点
  10. Linux 高 wio 分析