- 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.
推薦閱讀
- Building a Game with Unity and Blender
- C# Programming Cookbook
- 實用防銹油配方與制備200例
- SEO智慧
- Hands-On C++ Game Animation Programming
- Kinect for Windows SDK Programming Guide
- 程序員修煉之道:通向務實的最高境界(第2版)
- 深入理解Android:Wi-Fi、NFC和GPS卷
- 21天學通C++(第5版)
- Access 2010中文版項目教程
- Visual Basic程序設計習題與上機實踐
- Buildbox 2.x Game Development
- Xamarin Blueprints
- Learning Nessus for Penetration Testing
- Solr權威指南(下卷)