语法示例: while 条件为真 do echo ok done #!/bin/bash while true do echo ok done while循环数字 #!/bin/bash a=1 b=9 while [ $a -lt 10 ] do sum=$((a + b)) echo $a + ...
分类:
系统相关 时间:
2021-06-02 11:02:44
阅读次数:
0
示例: for i in 1 2 3 do echo $i done #!/bin/bash for i in {1..100} do echo $i done for 循环指定分隔符 以冒号为分隔符 IFS=: 以换行符作为分隔符 IFS=$'\n' 以行为单位读取数据 #!/bin/bash I ...
分类:
系统相关 时间:
2021-06-02 11:00:55
阅读次数:
0
给定一个包含电话号码列表(一行一个电话号码)的文本文件 file.txt,写一个单行 bash 脚本输出所有有效的电话号码。 你可以假设一个有效的电话号码必须满足以下两种格式: (xxx) xxx-xxxx 或 xxx-xxx-xxxx。(x 表示一个数字) 你也可以假设每行前后没有多余的空格字符。 ...
分类:
编程语言 时间:
2021-06-02 10:54:40
阅读次数:
0
包装类 Byte、Character、Boolean、Long、Short、Integer、Double、Float 这里拿Integer作举例说明,其他几种包装类类似。 为什么使用包装类? 某些方法的参数必须是对象,为了让基本数据类型的数据能作为参数,提供了包装类! 包装类可以提供更多的功能 In ...
分类:
其他好文 时间:
2021-06-02 10:50:19
阅读次数:
0
一、总和 i = 1 sum = 0 while i <= 100: sum += i i += 1 print(sum) 二、奇数和 i = 1 sum = 0 while i <= 100: if i % 2 != 0: sum += i i += 1 print(sum) 三、偶数和 i = ...
分类:
编程语言 时间:
2021-05-25 18:19:09
阅读次数:
0
部署# 服务端# 安装 NFS 服务 #执行以下命令安装 NFS 服务, #apt 会自动安装 nfs-common、rpcbind 等软件包 sudo apt install nfs-kernel-server 创建共享目录 在服务器端创建 /nfs 目录。 编写配置文件 vim /etc/exp ...
分类:
其他好文 时间:
2021-05-25 18:14:09
阅读次数:
0
let date = new Date() for (let m = 1; m < 13; m++) { let num = new Date(date.getFullYear(), m, 0).getDate(); for (let i = 1; i < num + 1; i++) { //再把天 ...
分类:
Web程序 时间:
2021-05-25 17:54:29
阅读次数:
0
摘自:https://blog.csdn.net/xuancbm/article/details/81436681 readline库的简单使用这周要实现一个简单的 shell, 平时使用bash, zsh这些shell的时候, 如果文件名或命令太长,又或者要频繁执行几条命令的话,最常用的应该就是t ...
分类:
其他好文 时间:
2021-05-25 17:44:29
阅读次数:
0
1、OS模块 函数/变量 描述 os.environ 系统的环境变量 os.system(command) 在子shell中执行操作系统命令, 注意使用双引号,没有加入系统环境变量的应用,要使用全路径,否则直接使用可执行程序如pycharm64.exe os.sep 路径中使用的分隔符 os.pat ...
分类:
编程语言 时间:
2021-05-24 17:23:30
阅读次数:
0
shell 在线编辑器:https://www.runoob.com/try/runcode.php?filename=helloworld&type=bash 一下脚本自行测试查看结果 echo "Hello World !" your_name="qinjx" echo your_name fo ...
分类:
系统相关 时间:
2021-05-24 17:21:02
阅读次数:
0