``````str="this is shell";
for i in \$str
do
echo \$i;
done
``````

``````this
is
shell
``````

``````for i in "this is shell"
do
echo \$i
done
``````

``````this is shell
``````

2个回答

shell脚本中for循环是怎么处理的例如: #cat a.txt 1 12 2 22 #cat test.sh #!/bin/bash for i in `awk '{print \$0}'` do echo \$i done #./test.sh 1 12 2 22 为什么其输出结果不为: 1 12 2 22 主要问的意思是for,in语句其处理数据时候是通过换行分割还是，有特殊的方法对数据进行分割
shell:for循环逐行逐列追加文件

shell编程for循环的问题

Shell Pyramid
Problem Description In the 17th century, with thunderous noise, dense smoke and blazing fire, battles on the sea were just the same as those in the modern times. But at that time, the cannon ,were extremely simple. It was just like an iron cylinder, with its rearward end sealed and forward end open. There was a small hole at the rearward end of it, which was used to install the fuse. The cannons on the warships were put on small vehicles which had four wheels and the shells were iron spheres with gunpowder in them. At that time, it was said that there was an intelligent captain, who was also a mathematician amateur. He liked to connect everything him met to mathematics. Before every battle, he often ordered the soldiers to put the shells on the deck and make those shells to form shell pyramids. Now let's suppose that a shell pyramid has four layers, and there will be a sequence of ordinal numbers in every layer. They are as the following figure: In the figure, they are the first layer, the second layer, the third layer and the fourth layer respectively from the left to the right. In the first layer, there is just 1 shell, and its ordinal number is 1. In the second layer, there are 3 shells, and their ordinal numbers are 1, 2, and 3. In the third layer, there are 6 shells, and their ordinal numbers are 1, 2, 3, 4, 5, and 6. In the fourth layer, there are 10 shells, and their ordinal numbers are shown in the figure above. There are also serial numbers for the whole shell pyramid. For example, the serial number for the third shell in the second layer is 4, the serial number for the fifth shell in the third layer is 9, and the serial number for the ninth shell in the fourth layer is 19. There is also a interrelated problem: If given one serial number s, then we can work out the s th shell is in what layer, what row and what column. Assume that the layer number is i, the row number is j and the column number is k, therefore, if s=19, then i=4, j=4 and k=3. Now let us continue to tell about the story about the captain. A battle was going to begin. The captain allotted the same amount of shells to every cannon. The shells were piled on the deck which formed the same shell pyramids by the cannon. While the enemy warships were near, the captain ordered to fire simultaneously. Thunderous sound then was heard. The captain listened carefully, then he knew that how many shells were used and how many were left. At the end of the battle, the captain won. During the break, he asked his subordinate a question: For a shell pyramid, if given the serial number s, how do you calculate the layer number i, the row number j and column number k? Input First input a number n,repersent n cases.For each case there a shell pyramid which is big enough, a integer is given, and this integer is the serial number s（s<2^63）. There are several test cases. Input is terminated by the end of file. Output For each case, output the corresponding layer number i, row number j and column number k. Sample Input 2 19 75822050528572544 Sample Output 4 4 3 769099 111570 11179
shell 里面for循环的工作原理，什么时候释放资源

Shell Pyramid 的实现
Problem Description In the 17th century, with thunderous noise, dense smoke and blazing fire, battles on the sea were just the same as those in the modern times. But at that time, the cannon ,were extremely simple. It was just like an iron cylinder, with its rearward end sealed and forward end open. There was a small hole at the rearward end of it, which was used to install the fuse. The cannons on the warships were put on small vehicles which had four wheels and the shells were iron spheres with gunpowder in them. At that time, it was said that there was an intelligent captain, who was also a mathematician amateur. He liked to connect everything him met to mathematics. Before every battle, he often ordered the soldiers to put the shells on the deck and make those shells to form shell pyramids. Now let's suppose that a shell pyramid has four layers, and there will be a sequence of ordinal numbers in every layer. They are as the following figure: In the figure, they are the first layer, the second layer, the third layer and the fourth layer respectively from the left to the right. In the first layer, there is just 1 shell, and its ordinal number is 1. In the second layer, there are 3 shells, and their ordinal numbers are 1, 2, and 3. In the third layer, there are 6 shells, and their ordinal numbers are 1, 2, 3, 4, 5, and 6. In the fourth layer, there are 10 shells, and their ordinal numbers are shown in the figure above. There are also serial numbers for the whole shell pyramid. For example, the serial number for the third shell in the second layer is 4, the serial number for the fifth shell in the third layer is 9, and the serial number for the ninth shell in the fourth layer is 19. There is also a interrelated problem: If given one serial number s, then we can work out the s th shell is in what layer, what row and what column. Assume that the layer number is i, the row number is j and the column number is k, therefore, if s=19, then i=4, j=4 and k=3. Now let us continue to tell about the story about the captain. A battle was going to begin. The captain allotted the same amount of shells to every cannon. The shells were piled on the deck which formed the same shell pyramids by the cannon. While the enemy warships were near, the captain ordered to fire simultaneously. Thunderous sound then was heard. The captain listened carefully, then he knew that how many shells were used and how many were left. At the end of the battle, the captain won. During the break, he asked his subordinate a question: For a shell pyramid, if given the serial number s, how do you calculate the layer number i, the row number j and column number k? Input First input a number n,repersent n cases.For each case there a shell pyramid which is big enough, a integer is given, and this integer is the serial number s（s<2^63）. There are several test cases. Input is terminated by the end of file. Output For each case, output the corresponding layer number i, row number j and column number k. Sample Input 2 19 75822050528572544 Sample Output 4 4 3 769099 111570 11179

1 python有没有IDE？ 2 python shell 是什么？ 3 如何用python生成exe？
unix操作系统使用shell编程

shell脚本调用另一个shell脚本问题

Linux shell中如何比较两个字符串的大小？

JAVA飞机大战小游戏求解答
impala shell脚本不执行

shell中遍历当前目录中所有文件和子文件中的log后缀，并删除

shell 无法获取命令的输出结果
shell 获取脚本的输出结果 百度了很多资料，依然无法得到我想要的答案 我本来是要执行这个命令 ./cspub/cs_client -c ./cspub//client/client.conf -f ./url_list/tgb 这条命令输出结果应该是 NOTICE: 12-04 22:35:46: * 0 [connect_scheduler:485] yq01-ps-beehive-agent118850.yq01:7455 NOTICE: 12-04 22:35:46: * 0 [main:1370] login succeed, task_id = 2495372168972472539 NOTICE: 12-04 22:35:46: * 0 [send_task:870] send 3200 urls. 0 online host num 31 也就是说4条结果，但是每次我获取结果的时候，只能获取到最后一行，“0 online host num 31” 其他三行无法获得 代码： #!/bin/bash A=`./cspub/cs_client -c ./cspub//client/client.conf -f ./url_list/tgbdaa` echo 'aaaaaaaaa' echo \$A echo \$? 输出结果： NOTICE: 12-04 22:40:59: * 0 [connect_scheduler:485] yq01-ps-beehive-agent118876.yq01:7455 NOTICE: 12-04 22:40:59: * 0 [main:1370] login succeed, task_id = 2495460135153963424 NOTICE: 12-04 22:40:59: * 0 [send_task:870] send 3200 urls. aaaaaaaaa online host num 31 0

Java学习的正确打开方式

linux系列之常用运维命令整理笔录

Python十大装B语法
Python 是一种代表简单思想的语言，其语法相对简单，很容易上手。不过，如果就此小视 Python 语法的精妙和深邃，那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点，并附上详细的实例代码。如能在实战中融会贯通、灵活使用，必将使代码更为精炼、高效，同时也会极大提升代码B格，使之看上去更老练，读起来更优雅。 1. for - else 什么？不是 if 和 else 才

2019年11月中国大陆编程语言排行榜
2019年11月2日，我统计了某招聘网站，获得有效程序员招聘数据9万条。针对招聘信息，提取编程语言关键字，并统计如下： 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7

JDK12 Collectors.teeing 你真的需要了解一下

SQL-小白最佳入门sql查询一

【图解经典算法题】如何用一行代码解决约瑟夫环问题

“狗屁不通文章生成器”登顶GitHub热榜，分分钟写出万字形式主义大作

GitHub标星近1万：只需5秒音源，这个网络就能实时“克隆”你的声音

《程序人生》系列-这个程序员只用了20行代码就拿了冠军

11月8日，由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办，科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。 　　区块链技术被认为是继蒸汽机、电力、互联网之后，下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力，电力解决了人类基本的生活需求，互联网彻底改变了信息传递的方式，区块链作为构造信任的技术有重要的价值。 　　1...

【技巧总结】位运算装逼指南

【管理系统课程设计】美少女手把手教你后台管理
【文章后台管理系统】URL设计与建模分析+项目源码+运行界面 栏目管理、文章列表、用户管理、角色管理、权限管理模块（文章最后附有源码） 1. 这是一个什么系统? 1.1 学习后台管理系统的原因 随着时代的变迁，现如今各大云服务平台横空出世，市面上有许多如学生信息系统、图书阅读系统、停车场管理系统等的管理系统，而本人家里就有人在用烟草销售系统，直接在网上完成挑选、购买与提交收货点，方便又快捷。 试想，若没有烟草销售系统，本人家人想要购买烟草，还要独自前往药...
4G EPS 第四代移动通信系统