给钱做任务的网站,设计公司属于什么企业类型,wordpress显示栏目,电商营销推广方案1、写一个 bash脚本以输出数字 0 到 100 中 7 的倍数(0 7 14 21...)的命令。
vim /shell/homework1.sh
#!/bin/bash
for num in {0..100}
doif [[ num%7 -eq o ]];thenecho $numfi
done执行输出脚本查看输出结果
输出结果#xff1a; 2、写一个 bash脚本以统计一个文本文件…1、写一个 bash脚本以输出数字 0 到 100 中 7 的倍数(0 7 14 21...)的命令。
vim /shell/homework1.sh
#!/bin/bash
for num in {0..100}
doif [[ num%7 -eq o ]];thenecho $numfi
done执行输出脚本查看输出结果
输出结果 2、写一个 bash脚本以统计一个文本文件 nowcoder.txt中字母数小于8的单词。
假设 nowcoder.txt 内容如下 how they are implemented and applied in computer
首先创建一个nowcoder.txt文件用作测试
vim /test/nowcoder.txt
how they are implemented and applied in computer 然后配置脚本
vim /shell/homework2.sh
#!/bin/bash
for n in $(cat /test/nowcoder.txt)
doif [ expr length $n -lt 8 ]thenecho $nfi
done执行脚本查看输出结果
输出结果 3、写一个 bash脚本以实现一个需求去掉输入中含有this的语句把不含this的语句输出 示例: 假设输入如下 that is your bag is this your bag? to the degree or extent indicated. there was a court case resulting from this incident welcome to nowcoder
首先创建一个测试文件用来储存输入的内容
vim /test/test1
编写脚本文件
#!/bin/bash
while true
do read -p inputif you want to stop inputting,please enter stop markif [ $mark stop ];thenbreakfiecho $mark /test/test1
done
echo Output results
grep -w this -v /test/test1
echo /test/test1执行脚本查看输出结果