- 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.
推薦閱讀
- iOS Game Programming Cookbook
- PHP動態網站程序設計
- Scratch 3游戲與人工智能編程完全自學教程
- Silverlight魔幻銀燈
- Apache Karaf Cookbook
- PHP+MySQL網站開發項目式教程
- Python算法從菜鳥到達人
- Mastering Linux Network Administration
- Mastering Android Development with Kotlin
- Serverless computing in Azure with .NET
- Raspberry Pi Robotic Blueprints
- MINECRAFT編程:使用Python語言玩轉我的世界
- HTML5+CSS3+JavaScript 從入門到項目實踐(超值版)
- Mastering Embedded Linux Programming
- Android初級應用開發