给定以下 shell 脚本,如何重新排列输出以插入新行?
#!/bin/bash
echo -e $1 ` date `
我尝试了 -e 开关,但无济于事。
我的意思是如果我输入:./script.sh "
ls -la"
我会得到以下输出:
total 4732 drwxr-xr-x 4 root root 4096 2013-01-09 15:32 . drwx------ 28 root root 4096 2013-01-09 15:32 .. -rw-r--r-- 1 root root 484063 2013-01-06 05:22 Blackhat-europe-09-Damele-SQLInjection-whitepaper.pdf -rwxrwxrwx 1 root root 3787587 2013-01-06 05:10 FoxitReader-1.1.0.tar.bz2 -r-------- 1 root root 127693 2013-01-03 22:55 HackYeah-SQL-Injection.pdf drwxr-xr-x 2 root root 4096 2013-01-05 21:47 Inst_DVWA -rw-r--r-- 1 root root 3223 2012-12-22 00:47 nmap-O -rw-r--r-- 1 root root 284 2013-01-06 07:31 payload_dvwa.txt -rwxrwxrwx 1 root root 30 2013-01-09 11:18 script (copy).sh -rwxrwxrwx 1 root root 33 2013-01-09 15:32 script.sh -rw-r--r-- 1 root root 395493 2013-01-06 05:03 SQLmap_README.pdf -rwxrwxrwx 1 root root 705 2013-01-07 15:22 start_dvwa.sh -rw-r--r-- 1 root root 834 2013-01-06 07:31 Unsaved Document 1.txt drwxr-xr-x 2 root root 4096 2012-12-19 18:47 ZAP_certificate Wed Jan 9 15:32:55 CET 2013
我想得到类似这样的输出:
total 4732
drwxr-xr-x 4 root root 4096 2013-01-09 15:32 .
drwx------ 28 root root 4096 2013-01-09 15:32 ..
-rw-r--r-- 1 root root 484063 2013-01-06 05:22 Blackhat-europe-09-Damele-SQLInjection-whitepaper.pdf
-rwxrwxrwx 1 root root 3787587 2013-01-06 05:10 FoxitReader-1.1.0.tar.bz2
-r-------- 1 root root 127693 2013-01-03 22:55 HackYeah-SQL-Injection.pdf
drwxr-xr-x 2 root root 4096 2013-01-05 21:47 Inst_DVWA
-rw-r--r-- 1 root root 3223 2012-12-22 00:47 nmap-O
-rw-r--r-- 1 root root 284 2013-01-06 07:31 payload_dvwa.txt
-rwxrwxrwx 1 root root 30 2013-01-09 11:18 script (copy).sh
-rwxrwxrwx 1 root root 33 2013-01-09 15:32 script.sh
-rw-r--r-- 1 root root 395493 2013-01-06 05:03 SQLmap_README.pdf
-rwxrwxrwx 1 root root 705 2013-01-07 15:22 start_dvwa.sh
-rw-r--r-- 1 root root 834 2013-01-06 07:31 Unsaved Document 1.txt
drwxr-xr-x 2 root root 4096 2012-12-19 18:47 ZAP_certificate
非常感谢