简体   繁体   English

Linux Shell脚本编制:存储命令行程序的输出

[英]Linux Shell scripting: Storing the output of a command line program

The following command returns 2 lines and those are the temperatures of my CPU's: 以下命令返回两行,它们是我的CPU的温度:

acpi -t

How would I go about storing those 2 lines in a variable in a bash script so I can work with them? 我该如何将这2行存储在bash脚本的变量中,以便可以使用它们?

你尝试过这个吗?

var=$(acpi -t)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM