当前位置: 首页 > news >正文

大名做网站豫建设标文件在哪个网站公布

大名做网站,豫建设标文件在哪个网站公布,东营做网站优化的公司,网络规划设计师视频网盘题目 提示#xff1a;没有基础请先看看基础部分的讲解#xff0c;否则看不懂 1#xff0c;编写函数#xff0c;实现判断是否无位置参数#xff0c;如无参数#xff0c;提示错误 代码#xff1a; #bash/bin function a() {b$# #判断传入的参数个数 # echo $b…题目 提示没有基础请先看看基础部分的讲解否则看不懂 1编写函数实现判断是否无位置参数如无参数提示错误 代码 #bash/bin function a() {b$# #判断传入的参数个数 # echo $bif [ $b -eq 0 ] # 看参数个数是不是等于0 thenecho noelseecho yesfi } a1当不传入参数时结果为 no2当传入参数时结果为 yes2编写函数实现两个数字做为参数返回最大值 代码 function a() { # 定义函数num1$1 # 获取第一个参数 # echo num1:$num1num2$2 # echo num2:$num2if [ $num1 -gt $num2 ] # 2个参数进行比较thenecho $num1 # 返回第一个参数elseecho $num2 # 返回得第二个参数fi } c$(a 200 300) # 传入2个参数并且将返回值赋值给c echo the $c is more big运行输出结果 [rootlocalhost ~]# bash functiontest.sh the num1:200 num2:300 300 is more big3编写函数实现两个整数位参数计算加减乘除 代码 a(){one$1two$2echo $one $two expr $one $twoecho $one - $two expr $one - $twoecho $one * $two expr $one \* $twoecho $one / $two expr $one / $twoprintf $one / $two expr $one / $two\n} a 2 3运行结果 [rootlocalhost ~]# bash functiontest.sh 2 3 5 2 - 3 -1 2 * 3 6 2 / 3 0 2 / 3 04、将/etc/shadow文件的每一行作为元数赋值给数组 代码 function a(){awc -l /etc/shadow | cut -d -f1 # 将目标文件进行剪切提取需要的数据这里代表数据个数 for i in seq $a dobexpr $i - 1 # 数组下标arr[$b]awk NR$i{print} /etc/shadow # 将对应的哪一行数据放入到数组 done } a echo ${arr[0]} # 打印数组的第一个元素 echo ${arr[1]} #第二个 echo ${arr[2]} echo ${arr[3]}以上的结果显示为: 结果的验证可以用cat 命令对目标文件进行对比 [rootlocalhost ~]# bash functiontest.sh root:$6$SqQF33Q5poRxzqNJ$mAZ7EJuymCGVS6HxSAinq4danhF48kUbkyg/Kck3VJ8mIO5tDJlrsbQ04.aXbUb63rif82rIR/Xuatvcdj6Bp1::0:99999:7::: bin:*:19121:0:99999:7::: daemon:*:19121:0:99999:7::: adm:*:19121:0:99999:7:::5使用关联数组统计文件/etc/passwd中各个用户的shell类型 代码 function a(){read -p which users shell type that you want find?: shell_type # 提示加读取输入的变量declare -A arry # 必须声明关联数组lwc -l /etc/passwd | cut -d -f1 # 计算数据的条数for i in seq $ldo # ass-arry[expr $i - 0] indexcat /etc/passwd | awk BEGIN{FS:}{print $1} | awk NR$i{print} # 关联数组的下标# echo index $indexdeclare -A arryarry[$index]cat /etc/passwd | awk BEGIN{FS:}{print $7} | awk NR$i{print} # 关联数组的值doneecho the user $shell_types shell type is ${arry[$shell_type]} # 格式化输出 } a 运行的结果 [rootlocalhost ~]# bash functiontest.sh which users shell type that you want find?:fu the user fus shell type is /bin/bash[rootlocalhost ~]# bash functiontest.sh which users shell type that you want find?:root the user roots shell type is /bin/bash[rootlocalhost ~]# bash functiontest.sh which users shell type that you want find?:bin the user bins shell type is /sbin/nologin6使用关联数组按扩展名统计指定目录中文件的数量 代码 function a() {read -p input a file path (absolute):(such as input /etc/) path # 输入路径read -p which type of file are you count ?:(such as input txt or sh ...) type1 # 输入文件类型als -l $path | awk {print $9} | grep ^[^$] | awk BEGIN{FS.}{print $2} # 看有几个文件有后缀名declare -A arrfor i in $ado# echo file type: $iarr[$i]expr ${arr[$i]} 1 # 对文件类型计数表示该类型文件个数doneecho the file of type $type1 have ${arr[$type1]} } a运行结果如下结果的验证可以用自己数 [rootlocalhost ~]# bash functiontest.sh input a file path (absolute):(such as input /etc/)/etc/ which type of file are you count ?:(such as input txt or sh ...)conf the file of type conf have 36[rootlocalhost ~]# bash functiontest.sh input a file path (absolute):(such as input /etc/)/etc/ which type of file are you count ?:(such as input txt or sh ...)d the file of type d have 247编写函数 判断是否有参数存在为Ok不存在为FAILED要求绿色OK和红色FAILED 代码 function a() {b$# ## echo $bif [ $b -eq 0 ]thenecho -e \e[31m failde \e[0m;elseecho -e \e[32m ok \e[0m;fi } a 1
http://www.dnsts.com.cn/news/248577.html

相关文章:

  • 网站建站视频教程网站建设年份查询
  • 自己电脑做网站需要备案吗2网站的手机客户端怎样做
  • 胶州市住房建设局网站seo网站点击量排名优化
  • 做网站怎么把字弄图片上去利润很吓人10个冷门创业
  • 做网站需要竞品分析么能打开所有网站的浏览器
  • html网站开头怎么做的wap免费建站
  • c 网站开发项目做自己的网站能赚钱吗
  • 游戏优化大师官网长沙网站seo优化公司
  • 手机模板网站生成制作软件网站会动的页面怎么做的
  • 做那个的网站谁有开封市网站建设公司
  • 房产网站建设ppt网站ftp文件
  • 可以上传资源的网站开发费用百度下拉框推广网站
  • 外管局网站 报告怎么做报告查一查
  • 做网站自己上传电影要多大服务器东莞高端品牌网站建设
  • 安阳企业建网站seo快速优化
  • 网站开发项目需求分析电子信息工程是互联网专业吗
  • 如何做好公司网站网站建设的模板
  • 怎么查看网站是否被收录山西大型网络营销设计
  • 网站友链交换平台沈阳好的互联网设计
  • 韶关公司做网站国内扁平化网站欣赏
  • seo网站排名后退wordpress 经过天数
  • 网站设计公司如何做好网站建设建设网站用什么服务器
  • 模板演示网站美康优选网站怎么做的
  • 网站建设的概念q a wordpress插件
  • 网站连接数据库失败网页升级访问中自动跳转
  • dedecms win8风格网站模板青岛建网站公司哪家专业
  • 建设网站公司需要准备哪些材料wordpress主题 搜索
  • 唐山网站建设唐山做网站wordpress主题dooplay
  • 慈溪网站制作网站建设排名的公司哪家好
  • 个体工商户注册流程资阳seo