Đề: Đây là code mình viết, nói chung là chạy ổn File thucthi.sh Mã: #!/bin/bash echo "Day la chuong trinh Bash shell!" mkdir /home/hongoctrien/Desktop/Lienket sudo fdisk -l sudo mount -t ext4 /dev/sda3 /home/hongoctrien/Desktop/Lienket mkdir /home/hongoctrien/Desktop/Viethan mkdir /home/hongoctrien/Desktop/Viethan/Khoa mkdir /home/hongoctrien/Desktop/Viethan/Khoa/KHMT mkdir /home/hongoctrien/Desktop/Viethan/Khoa/THUD mkdir /home/hongoctrien/Desktop/Viethan/Khoa/TMDT mkdir /home/hongoctrien/Desktop/Viethan/Phongban mkdir /home/hongoctrien/Desktop/Viethan/Phongban/Daotao mkdir /home/hongoctrien/Desktop/Viethan/Phongban/Ketoan mkdir /home/hongoctrien/Desktop/Viethan/Phongban/Tonghop gedit /home/hongoctrien/Desktop/Viethan/Khoa/luutru.txt cp /home/hongoctrien/Desktop/Viethan/Khoa/luutru.txt /home/hongoctrien/Desktop/Viethan/Phongban mv /home/hongoctrien/Desktop/Viethan/Phongban/luutru.txt /home/hongoctrien/Desktop/Viethan/Phongban/tailieu.txt gedit /home/hongoctrien/Desktop/Viethan/Phongban/tailieu.txt cat /home/hongoctrien/Desktop/Viethan/Khoa/luutru.txt /home/hongoctrien/Desktop/Viethan/Phongban/tailieu.txt >/home/hongoctrien/Desktop/Viethan/noi.txt ls -l /home/hongoctrien/Desktop/Viethan/noi.txt gzip /home/hongoctrien/Desktop/Viethan/Khoa/luutru.txt echo "Day la noi dung cua file noi.txt" view /home/hongoctrien/Desktop/Viethan/noi.txt sudo adduser sinhvienmang sudo addgroup nhommang sudo chmod u=rwx,g=rx,o=rwx /home/hongoctrien/Desktop/Viethan/noi.txt sudo chown sinhvienmang /home/hongoctrien/Desktop/Viethan/noi.txt sudo chgrp nhommang /home/hongoctrien/Desktop/Viethan/noi.txt ls -l /home/hongoctrien/Desktop/Viethan/noi.txt File xoathucthi.sh Mã: #!/bin/bash echo "Xoa cac cong viec da lam." sudo umount /home/hongoctrien/Desktop/Lienket rm -r /home/hongoctrien/Desktop/Lienket rm -r /home/hongoctrien/Desktop/Viethan sudo userdel -r sinhvienmang sudo groupdel nhommang clear echo "Da thuc hien xong!"
Mã: mkdir /home/hongoctrien/Desktop/Viethan mkdir /home/hongoctrien/Desktop/Viethan/Khoa mkdir /home/hongoctrien/Desktop/Viethan/Khoa/KHMT mkdir /home/hongoctrien/Desktop/Viethan/Khoa/THUD mkdir /home/hongoctrien/Desktop/Viethan/Khoa/TMDT mkdir /home/hongoctrien/Desktop/Viethan/Phongban mkdir /home/hongoctrien/Desktop/Viethan/Phongban/Daotao mkdir /home/hongoctrien/Desktop/Viethan/Phongban/Ketoan mkdir /home/hongoctrien/Desktop/Viethan/Phongban/Tonghop Có thể thay bằng mấy lệnh sau: Mã: mkdir -pv /home/hongoctrien/Desktop/Viethan/{Khoa,Phongban} mkdir -pv /home/hongoctrien/Desktop/Viethan/Khoa/{KHMT,THUD, TMDT} mkdir -pv /home/hongoctrien/Desktop/Viethan/Phongban/{Daotao,Ketoan,Tonghop} Mã: sudo chown sinhvienmang /home/hongoctrien/Desktop/Viethan/noi.txt sudo chgrp nhommang /home/hongoctrien/Desktop/Viethan/noi.txt Em có thể thay thế bằng lệnh sau: Mã: chown sinhvienmang:nhommang /home/hongoctrien/Desktop/Viethan/noi.txt -->làm đã nhuần ---> mở rộng và phát triển---> kinh nghiệm.