当前位置:网站首页>Shell script command results are saved to variables with line breaks
Shell script command results are saved to variables with line breaks
2022-04-22 23:06:00 【Data from scratch】
stay shell in , You can directly save the running result of the command to a variable , And then use echo No newline character is found when outputting , Later, it was found that double quotation marks were needed , To keep the newline .
echo $result No line breaks
echo "$result" With line break
Simple test script run.sh
#!/bin/bash
result=$(ls -l)
echo $result
echo
echo "$result"
Reference resources :https://blog.csdn.net/qq_34039018/article/details/106998053
版权声明
本文为[Data from scratch]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222256165394.html
边栏推荐
- 未来源码 | 吴恩达教授重磅演讲:Tips for using a data-centric AI approach
- 正则表达式——IP地址匹配
- 【毕业设计】答 辩 技 巧 一(以一个过来人的身份,祝各位答辩 过 过 过)
- 新闻速递 I MobTech通过中国信通院“安全专项评测”
- L1-071 前世档案 (20 分)
- [Error]dyld: Library not loaded:
- Utilisation et principes de base de minio
- public speaking
- 光学指纹模组解锁方案设计指纹锁方案
- SystemVerilog 验证-测试平台编写指南学习笔记(3):连接设计和测试平台
猜你喜欢

解决require is not defined的报错问题

3. 源码

Flutter 一文搞定图片选择和图片上传

The article "fluent" is used to select and upload pictures

CSV Column Extract列提取

英语 | Day13、14 x 句句真研每日一句(平行、嵌套结构)

C add log4net log (console and file) to console application

如何使用icy进行小鼠的行为学追踪?

加密模式介绍(ECB、CBC、PCBC、CFB、OFB、CTR)
![High number | [differential calculus and application of multivariate functions] error prone problems and detailed explanation of Li Lin 880](/img/24/2c2fa861bc0fb3e0a33d13ce01db38.png)
High number | [differential calculus and application of multivariate functions] error prone problems and detailed explanation of Li Lin 880
随机推荐
how to become professional
C add log4net log (console and file) to console application
Online yaml to XML tool
Gbase 8A common parallelism parameter adjustment to improve performance
新闻速递 I MobTech通过中国信通院“安全专项评测”
KunlunDB对MySQL私有DML语法的支持
CISSP认证每日知识点(2022年4月22日)
L1-049 天梯赛座位分配 (20 分)( for循环的深入理解+三维数组+错误分析)
Query uid from proc
Future source code | Professor Wu Enda's lecture: Tips for using a data centric AI approach
django连接数据库获取数据
【板栗糖GIS】编程的本质—(视频笔记)
SQL语言详解
[原创][开源]C# Winform DPI自适应方案,SunnyUI三步搞定
辰视工业级机器视觉 | 焊缝检测解决方案
php 一维数组去重
WebRTC系列-WebRTC基础(七)NAT、stun和turn(2)
MySQL日志保留策略:设置binlog日志保存天数、文件大小限制
Minio基本使用与原理
Go语言-使用协程高效计算0-2000内每个数的累加