SYSADMIN ZERO2HERO
TIP #1: XỬ LÝ FILE/OUTPUT COMMAND TỪNG DÒNG TRỰC TIẾP TRÊN SHELL
[[email protected] ~][9]$ cat /etc/passwd | while read line; do user=$(echo $line | cut -d":" -f1); echo $user; done
Đoạn quan trọng là đoạn pipeline sau command sinh ra output kết hợp với "while read line", mỗi dòng trong output sẽ được lưu lần lượt vào biến "$line", dựa vào đó rồi xử lý theo ý mình.