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

做网站泰安资源搜索

做网站泰安,资源搜索,电子商务作业做网站,苏州有什么好玩的地方吗1.算数运算命令有哪几种? (1) "(( ))"用于整数运算的常用运算符,效率很高 [rootshell scripts]# echo $((24*5**2/8)) #(( ))2452814 14 (2) "$[ ] "用于整数运算 [rootshell scripts]# echo $[24*5**2/8] #[ ]也可以运…

1.算数运算命令有哪几种?

(1) "(( ))"用于整数运算的常用运算符,效率很高

[root@shell scripts]# echo $((2+4*5**2/8))        #(( ))2+4×52÷8=14

14

(2) "$[ ] "用于整数运算

[root@shell scripts]# echo $[2+4*5**2/8]     #[ ]也可以运算

14

(3) "let"用于整数运算,类似于 (( ))

[root@shell scripts]# let r=2+4*5**2/8          #let也可以作整数运算

[root@shell scripts]# echo $r

14

(4) "expr"可用于整数运算,但还有很多其他的额外功能

[root@shell scripts]# expr 2 + 4 \* 5 / 8      #expr是外部命令运算运算符两边需要空格,且乘法*需要转义,**运算符在expr命令中并不支持。

4

[root@shell scripts]# expr  10 % 3               #取余,两边必须要有空格

1

(5) "bc"Linux下的一个计算器程序(适合整数及小数运算)

[root@shell scripts]# echo 2+3*6 | bc    #linux用于数学计算的高级计算器bc

20

(6) "declare"义变量值和属性,-i 参数可以用于定义整形变量,做运算

[root@shell scripts]# declare -i r2=2+3*6        #做运算

[root@shell scripts]# echo $r2

20

(7) "awk" 既可以用于整数运算,也可以用于小数运算

[root@shell scripts]# awk 'BEGIN {print 2+3*6/7}'  #可以进行小数预算

4.57143

BEGIN 是一个在 awk 中可用的特殊关键字,用于在处理输入之前执行一些初始操作。BEGIN 块通常用于设置变量、打印标题或执行其他一次性任务

2.定义变量url=https://blog.csdn.net/weixin_45029822/article/details/103568815

1)截取网站访问的协议

[root@shell ~]# url=https://blog.csdn.net/weixin_45029822/article/details/103568815
[root@shell ~]# echo $url
https://blog.csdn.net/weixin_45029822/article/details/103568815

[root@shell ~]# echo $url | grep -o "https"                 #-o只显示匹配到的结果
https

[root@shell ~]# echo $url | grep "\<https" -o      #正则
https

[root@shell ~]# echo "$url" | awk '/https/ {print "https"}'    
https

[root@shell ~]# echo ${url%:*}     #字符串变量切片
https

[root@shell ~]# echo $url | cut -d : -f1
https


2)截取网站访问账号信息

[root@shell ~]# echo ${url##*/}
103568815

[root@shell ~]# echo $url | cut -d / -f7
103568815

[root@shell ~]# echo $url | grep -o "103568815"
103568815

3.写一个脚本,完成以下要求:

给定一个用户:
1、如果其UID为0,就显示此为管理员;
2、否则,就显示其为普通用户;

[root@shell scripts2]# vim user1.sh +

#!/bin/bash

read -p "please input a user:" user
uid=`id $user -u`
if [ $uid -eq 0 ]
then
   echo The user with a UID of $uid is an administrator
else
   echo This user has a UID of $uid and is a regular user
fi

[root@shell scripts2]# chmod +x user1.sh 
[root@shell scripts2]# ./user1.sh 
please input a user:root
The user with a UID of 0 is an administrator
[root@shell scripts2]# ./user1.sh 
please input a user:fox
This user has a UID of 1001 and is a regular user

4.写一个脚本

判断当前系统上是否有用户的默认shell为bash;
如果有,就显示有多少个这类用户;否则,就显示没有这类用户;

[root@shell scripts2]# vim user2.sh +

#!/bin/bash

user=`grep "bash" /etc/passwd | wc -l`
if [ $user -eq 0 ]
then
   echo There are no users with a default shell of bash
else
   echo The number of users whose default shell is bash is $user
fi

[root@shell scripts2]# chmod +x user2.sh 
[root@shell scripts2]# ./user2.sh 
The number of users whose default shell is bash is 3

http://www.yidumall.com/news/75310.html

相关文章:

  • 电脑网站适应手机如何做网站外链出售
  • python可以做网站惠州优化怎么做seo
  • 企业产品做哪个网站推广好电脑培训班一般需要多少钱
  • 郑州网络推广电话seo算法
  • 做企业网站需要什么文件快推达seo
  • 网站建设执行力购物网站
  • 厦门网站建设设舆情监测软件免费版
  • 机械行业网站 方案武汉服装seo整站优化方案
  • 红杉树装修公司怎么样优化快速排名教程
  • 广州seo网站多少钱互联网营销工具有哪些
  • 在国外怎么做网站网站推广包括
  • 信息系统开发案例梁水才seo优化专家
  • 外贸独立网站制作线上营销的优势和劣势
  • 网站建设公司怎么做的云盘网页版登录
  • 网软志成个人商城网站盘古百度推广靠谱吗
  • 网站资源做缓存短视频关键词seo优化
  • 三网合一网站建设系统 价格在线seo推广软件
  • 网站里的滚动怎么做白杨seo教程
  • 网站突然被降权今日广东头条新闻
  • 郑州网站及优化长春seo代理
  • 海外红酒网站建设百度推广客服投诉电话
  • 沈阳公司网站制作热点事件营销案例
  • 简单网站建设运营各城市首轮感染高峰期预测
  • 东莞网站建设服务常用的关键词挖掘工具有哪些
  • 网站美工做确认取消对话框搜索引擎排名规则
  • 个人博客网站怎么注册陕西网站seo
  • 哪里网站建设深圳全网推广平台
  • 有做a50期货的网站seo工作怎么样
  • wordpress 建站短视频seo营销系统
  • 可以做mv 的视频网站推广宣传方式有哪些