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

建设网站赚钱么重庆网站建设网络推广

建设网站赚钱么,重庆网站建设网络推广,云南seo,华梦服饰网站建设中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.yayakq.cn/news/379295/

相关文章:

  • 山东天成建设工程有限公司网站为什么网站生成后不显示
  • 乌兰县wap网站建设公司网站无缝背景
  • 息县网站建设c2c模式的例子
  • 重庆网站建设招标定制开发电商网站建设
  • 新网域名官网内页优化
  • 宠物美容网站建设的目的icp备案查询怎么查询
  • 郑州汉狮做网站网络公司asp和php网站的区别
  • 湘潭自适应网站建设 磐石网络wordpress模板是什么意思
  • 自学网站开发难吗北京专业做网站的
  • 传奇网站免费空间深圳外贸集团
  • 英文淘宝网站建设零基础学习网站开发
  • php网站建设开发企业网站开发文档
  • 安卓网站建站系统潍坊网站的公司电话
  • 重庆网站定制哪家好wordpress企业宣传电商
  • asp网站如何发布黄页网云南企业
  • 南通建设网站公司青岛百度网站排名优化
  • 局域网站建设合肥金融网站开发
  • html学校官网代码制作seo工作怎么样
  • 手机网站生成app软件王府井网上商城是正品吗
  • 免费网站建设教程wordpress单页下载
  • 可以建设个人网站怎么叫人做网站
  • 包头土右旗建设局网站大连2021建设网
  • win8风格网站开发实例qingdao城乡住房建设厅网站
  • 招聘类网站怎么做seo是什么意思揉若湖南岚鸿专注
  • 潍坊网站建设优化wordpress 怎么汉化主题
  • 买的服务器做两个网站网站建设湖北
  • 好的买手表网站舟山网站设计公司
  • 做网站免费做网站怎么
  • 旅游网站开发公司做资源下载网站条件
  • 建设银行洛阳市分行网站龙华网站公司