From e44672d3fec8a85c86ce2370f6c5c21757ac9d63 Mon Sep 17 00:00:00 2001 From: wxy Date: Sun, 22 Jan 2017 14:46:02 +0800 Subject: [PATCH] PRF:20170119 How To Assign Output of a Linux Command to a Variable.md @GHLandy --- ...9 How To Assign Output of a Linux Command to a Variable.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20170119 How To Assign Output of a Linux Command to a Variable.md (91%) diff --git a/translated/tech/20170119 How To Assign Output of a Linux Command to a Variable.md b/published/20170119 How To Assign Output of a Linux Command to a Variable.md similarity index 91% rename from translated/tech/20170119 How To Assign Output of a Linux Command to a Variable.md rename to published/20170119 How To Assign Output of a Linux Command to a Variable.md index 86f8d55130..fff397f52f 100644 --- a/translated/tech/20170119 How To Assign Output of a Linux Command to a Variable.md +++ b/published/20170119 How To Assign Output of a Linux Command to a Variable.md @@ -1,7 +1,7 @@ 如何将 Linux 命令的输出赋值给变量 ================================== -运行一条命令时,它都会产生某种输出:该命令的期望结果,或者该命令执行细节的状态/错误消息。有些时候,你可能想要将某个命令的输出内容存储在一个变量中,以待在后续操作中取出来使用。 +运行一条命令时,它都会产生某种输出:要么是该命令的期望结果,或者是该命令执行细节的状态/错误消息。有些时候,你可能想要将某个命令的输出内容存储在一个变量中,以待在后续操作中取出来使用。 本文将介绍将 shell 命令赋值给变量的不同方法,这对于 shell 脚本编程是特别有用的。 @@ -10,7 +10,7 @@ ``` 变量名=$(命令) 变量名=$(命令 [命令选项 ...] 参数1 参数2 ...) -或者: +或者: 变量名='命令' 变量名='命令 [命令选项 ...] 参数1 参数2 ...' ```