寫一個 script, 只有一行, 包含用 pipe 串起來的各個 commands.
請將其設定成可執行. 執行時會列出系統現在所有 process 的 username.
每個 username 只出現一次.
(possible commands: ps, tail, head, cut, sort, uniq)
Note
- ps 的第一行為 header , 請先濾掉.
- ps -ef 的 username 只會顯示前八個, 如何顯示整個 username.
- 請將完成的作業放至 ~/unix-981/exer3/ 下.
- deadline 28 Oct, 00:05am
Example
your_prompt> ps -ef
UID PID PPID C STIME TTY TIME CMD <----- header
root 0 0 0 Aug 13 ? 0:05 sched
root 1 0 0 Aug 13 ? 0:23 /etc/init -
.........
zhsiao 18417 1 0 Oct 15 ? 0:00 screen
zhsiao 18425 18417 0 Oct 15 pts/4 0:00 /bin/bash
root 1783 303 0 08:07:55 ? 0:01 /usr/lib/ssh/sshd
root 20214 1 0 Oct 15 ? 0:04 devfsadmd
........
klim 2412 1785 0 11:28:57 pts/6 0:00 ps -ef
s9532100 2094 2004 0 09:46:10 pts/2 0:00 vi gcd.py <---- only first 8 char
your_prompt> ./your-cmd
klim
root
smmsp
daemon
zhsiao
s95321004 <----------- full username
your_prompt>