随笔分类 - 嵌入式
摘要:shell函数定义函数定义函数的格式function 函数名(){ 命令}在脚本中使用函数示例代码如下:hello(){echo "hello there today date is `date`"}在脚本中使用函数示例代码如下:#!/bin/sh#test20#在脚本中使用函数hello(){echo "Hello there today's data is `date`"}echo "now going to the function hello"helloecho "back from function&quo
阅读全文
摘要:case 语句语句格式case "$variable" in 模式1) 命令1 ... ;; 模式2) 命令2 ... ;;esac模式部分可使用通配符* 任意字符? 任意单个字符[..] 类或范围中任意字符简单的case语句示例代码如下:#!/bin/sh#test12#简单case语句echo -n "enter a number from 1 to 5 :"read ANS case $ANS in 1) echo "you select 1" ;; 2) echo "you select 2" ;; 3)
阅读全文
摘要:流程控制退出状态有四种退出状态最后命令退出状态$?控制次序命令$$ ||处理shell脚步本退出或shell退出及相就退出状态或函数返回码退出当前进程exit nn为数字流控制if then else格式为:if 条件1then 命令1elif 条件2then 命令2else 命令3fi简单的if 语句if条件 then 命令fi示例代码:测试1是否小于2#!/bin/sh#test#测试1是否小于2if [ "1" -lt "2" ]then#1小于2echo "yes,1 is less than 2"fi修改文件权限chmod
阅读全文
摘要:linux角本编程文件的安全与权限[root@localhost ~]# ls -l总计 48 #所有文件所占空间 -rw------- 1 root root 913 12-26 13:50 anaconda-ks.cfg-rw-r--r-- 1 root root 26586 12-26 13:50 install.log-rw-r--r-- 1 root root 3488 12-26 13:47 install.log.sysl - rw- --- --- 该文件的权限位文件类型 文件属主权限 同组用户权限 其他用户权限root 文...
阅读全文
摘要:tftp服务器trivial file transfer protocol 简单文件传输协议tftp有三种传输模式:netASCII 8位ASSCII八位组模式邮件模式检查是否安装[root@localhost Server]# rpm -qa | grep tftp-servertftp-server-0.49-2安装挂载安装文件镜像[root@localhost Server]# rpm -ivh tftp-0.49-2.i386.rpmwarning: tftp-0.49-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 3701718
阅读全文
浙公网安备 33010602011771号