shell for 循环
test.sh
#!/bin/bash
for str in "C语言" "http://www.bilibili.com" "成立7年了" "日IP数万"
do
echo $str >>demo.txt #将输入结果以追加的方式重定向到文件
done
执行
sudo chmod +x test.sh
./test.sh
cat demo.txt
输出
C语言
http://www.bilibili.com
成立7年了
日IP数万
shell for 循环的更多相关文章
- Linux Shell系列教程之(十二)Shell until循环
本文是Linux Shell系列教程的第(十二)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上两篇文章Linux Shell系列教程之(十)Shell for循环和Lin ...
- shell for循环+case的脚本(监控程序状态)
分享一个shell for循环+case的脚本(监控程序状态) 分享一个for循环+case的脚本(监控程序状态并执行相关操作) ,供大家学习参考. 复制代码代码如下: #/bin/bash set ...
- shell 各种循环判断
shell支持的循环有 Shell if else Shell case esac Shell for循环 Shell while循环 Shell until循环
- shell脚本--循环结构
shell的循环结构有while和for两种 for循环 #!/bin/bash #文件名:test.sh i=4 for i in 2 4 6 8 10 do echo $i done echo $ ...
- Linux Shell系列教程之(十一)Shell while循环
本文是Linux Shell系列教程的第(十一)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上一篇Linux Shell系列教程之(十)Shell for循环中,我们已经 ...
- Linux Shell系列教程之(十)Shell for循环
本文是Linux Shell系列教程的第(十)篇,更多Linux Shell教程请看:Linux Shell系列教程 基本任何语言都有自己的循环语句,Shell当然也不例外,今天就为大家介绍下Shel ...
- shell脚本-循环选择语句
shell脚本-循环选择语句 过程式编程语言: 顺序执行 选择执行 循环执行 注:条件中的变量,可以在执行语句中使用,不用在加上"$". if语句 根据命令的退出状态来执行命令 单 ...
- Linux shell for循环结构
Linux Shell for循环结构 循环结构 1:循环开始条件 2:循环操作 3:循环终止的条件 shell语言 for,while ...
- Shell 编程 循环语句
本篇主要写一些shell脚本循环语句的使用. for 循环 指定次数 #!/bin/bash for ((i=1;i<=10;i++)) do echo $i done [root@localh ...
- Linux 之Shell for循环
@代表所有参数所以如果后面跟上echo $v你会发现他会一次显示user userdebug eng $poo -le ${#prodlist[@]} 这句话是说 $poo小于等于prodlist中的 ...
随机推荐
- python 不知道是啥
1.判断两个大文件是否是同一个文件 import os import hashlib import time start = time.time() path1 = r"E:\视频资料\el ...
- python基础之 迭代器回顾,生成器,推导式
1.迭代器回顾 可迭代对象:Iterable 可以直接作用于for循环的对象统称为可迭代对象:Iterable.因为可迭代对象里面存在可迭代协议,所以才会被迭代 可迭代对象包括: 列表(list) 元 ...
- [LeetCode] 97. Interleaving String_ Hard tag: Dynamic Programming
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Example 1: Input: s1 = ...
- 爬虫 -----爬取百度时事热点和url
使用scrapy top.py 爬虫主要工作 pipelines.py 数据保存 main.py 执行脚本 items.py 初始化item
- vs2017 .net core 项目调试浏览器网页闪退Bug
from:https://blog.csdn.net/qq_36330228/article/details/82152187 vs更新2017最新版本后,项目调试浏览器莫名其妙出现闪退,每次都TMD ...
- window安装pycharm Django
pycharm 安装Pycharm 直接在官网下载就可以,这里说一下如何破解注册码的问题: 修改电脑中hosts文件(地址: C:\Windows\System32\drivers\etc ),改变 ...
- Linux实战
1.root用户无法删除文件 [root@VM_0_9_centos .ssh]# lsattr authorized_keys ----i----------- authorized_keys ls ...
- 20175208『Java程序设计』课程 结对编程练习_四则运算
20175208 结对编程练习_四则运算(第一周) 结对成员:20175208张家华,20175202葛旭阳 一.需求分析: 实现一个命令行程序,要求: (1)自动生成指定数量的小学四则运算题目(加. ...
- NI_NUMERICHOST" is not exported by the Socket module "getaddrinfo" is not expo
[root@Server3 ~]# masterha_check_repl --conf=/etc/masterha/app1.cnf "NI_NUMERICHOST" is no ...
- what i want
i want to be the object of every beautiful creature. they strongly want to talk with me, and study f ...