有两种方法可以将命令输出赋给变量:
反引号字符 `
testing='date'
$()格式
testing=$(date)
#!/bin/bash
# copy the /usr/bin directory listing to a log file
today=$(date +%y%m%d%k%M%S)
ls /usr/bin -al > log.$today
有两种方法可以将命令输出赋给变量:
反引号字符 `
testing='date'
$()格式
testing=$(date)
#!/bin/bash
# copy the /usr/bin directory listing to a log file
today=$(date +%y%m%d%k%M%S)
ls /usr/bin -al > log.$today