#!/bin/bash # assume current directory is ~/886326 # generate directory structure to the end of lab02 # create xx.txt - simple text file echo 0123456789 > xx.txt echo 1234567890 >> xx.txt echo 2345678901 >> xx.txt echo 3456789012 >> xx.txt echo 4567890123 >> xx.txt echo 5678901234 >> xx.txt echo 6789012345 >> xx.txt echo 7890123456 >> xx.txt echo 8901234567 >> xx.txt echo 9012345678 >> xx.txt # copy to 3 other files cp xx.txt xy.txt cp xx.txt xz.txt cp xx.txt yy.txt # create two diectories, H and K mkdir H K # create 5 subdirectories under H which are A, B, C, D and E mkdir ./H/A ./H/B ./H/C ./H/D ./H/E # create 2 subdirectories under K which are F and G mkdir ./K/F ./K/G # 1. copy xx.txt to A, C, D, F and H cp xx.txt ./H/A cp xx.txt ./H/C cp xx.txt ./H/D cp xx.txt ./K/F cp xx.txt ./H # 2. copy yy.txt to B, C, E, G and K cp yy.txt ./H/B cp yy.txt ./H/C cp yy.txt ./H/E cp yy.txt ./K/G cp yy.txt ./K # 3. access permission for files in H and K are (rw- rw- r--) or 664 chmod 664 ./H/xx.txt ./K/yy.txt # 4. access permission for files in A, B, C, D and E are (rw- r-- ---) or 640 chmod 640 ./H/A/xx.txt ./H/B/yy.txt ./H/C/*.txt ./H/D/xx.txt ./H/E/yy.txt # 5. access permission for files in F and G are (r-- --- ---) or 400 chmod 400 ./K/F/xx.txt ./K/G/yy.txt