Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在论坛上读到要查找随机字符串,您应该使用以下语法:
od -a -A n /dev/urandom | head -30 | tr -d ' ' | tr -d '\n' | awk '{print substr($0,1,256)}'
我怎么能把这个输出放到变量'var'而不是在屏幕上显示呢?
使用反引号或$(),即
$()
var=`command`
或者
var=$(command)
用反引号捕获它:``
VAR=`od -a -A n /dev/urandom | head -30 | tr -d ' ' | tr -d '\n' | awk '{print substr($0,1,256)}'`