[[email protected] ~]# echo It is the time $ (clock)
It is the time November 10, 2016 Thursday 18:20 38 sec -0.327027 seconds
Command substitution
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[[email protected] ~]# touch./file-$ (date +%f-%h-%m-%s). txt
[email protected] ~]# LL./
Total Dosage 44
-rw-r--r--. 1 root root 0 November 10 14:34 201711201500
-RW-------. 1 root root 1367 July 00:30 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 November 18:26 file-2016-11-10-18-26-04.txt
-rw-r--r--. 1 root root 0 November 18:26 file-2016-11-10-18-26-05.txt
-rw-r--r--. 1 root root 0 November 18:26 file-2016-11-10-18-26-06.txt
-rw-r--r--. 1 root root 0 November 18:26 file-2016-11-10-18-26-07.txt
-rw-r--r--. 1 root root 0 November 18:26 file-2016-11-10-18-26-08.txt
-rw-r--r--. 1 root root 0 November 18:26 file-2016-11-10-18-26-09.txt
-rw-r--r--. 1 root root 0 November 18:25 file-.txt
-rw-r--r--. 1 root root 27828 July 00:30 Install.log
-rw-r--r--. 1 root root 7572 July 00:28 install.log.syslog
This article is from the "James Zhan Linux Advanced ops" blog, so be sure to keep this source http://jameszhan.blog.51cto.com/10980469/1875542
Linux Basics-13, command replacement $ ()