官术网_书友最值得收藏!

Getting ready

Let's get ready for the exercise by creating a few text files and directories, and adding some content:

$ cd ~/
$ mkdir -p fileops
$ touch fileops/empty.txt
$ echo "abcd1234!!" > fileops/string.txt
$ echo "yieldswordinthestone" > fileops/swordinthestone.txt
$ touch fileops/read.txt fileops/write.txt fileops/exec.txt fileops/all.txt
$ chmod 111 fileops/exec.txt; chmod 222 fileops/write.txt; chmod 444 fileops/read.txt; fileops/all.txt;chmod 777 fileops/all.txt
$ sudo useradd bob
$ echo "s the name" > fileops/bobs.txt
$ sudo chown bob.bob fileops/bobs.txt

This recipe is about performing some simple file tests and to combine some of the other knowledge from earlier recipes on conditional logic, but with a twist—using user input from the CLI and file permissions.

Notice the commands  chmod, useradd, and chmod. Chmod is the command you may use to change the permissions of files for execution and more.
主站蜘蛛池模板: 西林县| 咸宁市| 桓台县| 仁怀市| 华安县| 平谷区| 名山县| 双柏县| 怀远县| 昭觉县| 巩留县| 兴城市| 枝江市| 同德县| 曲阳县| 华坪县| 南川市| 白朗县| 新余市| 拉萨市| 延安市| 中西区| 灵宝市| 湘潭县| 商丘市| 新疆| 铁岭市| 资源县| 涪陵区| 犍为县| 罗田县| 安化县| 壶关县| 六枝特区| 临澧县| 甘孜| 米易县| 鄢陵县| 措勤县| 密山市| 阿图什市|