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

  • Bash Cookbook
  • Ron Brash Ganesh Naik
  • 138字
  • 2021-07-23 19:17:40

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.
主站蜘蛛池模板: 揭阳市| 仁寿县| 蓝田县| 三亚市| 东海县| 东山县| 盐源县| 酉阳| 利川市| 海丰县| 浏阳市| 五大连池市| 门头沟区| 铜山县| 黑水县| 英超| 额尔古纳市| 娱乐| 宁明县| 台湾省| 松阳县| 大庆市| 隆林| 兖州市| 芜湖市| 静宁县| 绥阳县| 古蔺县| 南京市| 宜宾市| 涞水县| 仪陇县| 河东区| 稷山县| 大渡口区| 乌拉特后旗| 右玉县| 汉寿县| 腾冲县| 元江| 通榆县|