Add date command, rm_story.md, and minor edits
- Add `date` as first command to try in 01-navigation - Add Toy Story 2 rm -rf story (rm_story.md) and link from 05-scripting - Minor wording tweaks in 05-scripting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c57d7539d8
commit
175d18ad67
3 changed files with 35 additions and 4 deletions
|
|
@ -51,7 +51,8 @@ Clear out a directory structure for deletion using the command:
|
|||
$ rm -r *
|
||||
```
|
||||
|
||||
Be careful! Remember, there is no undo!
|
||||
***Be careful! Remember, there is no undo!*** For a cautionary tale about what can go wrong, see [The Toy Story 2 Disaster](rm_story.md).
|
||||
|
||||
|
||||
|
||||
## 2. Making a backup of a directory
|
||||
|
|
@ -88,7 +89,7 @@ total 20
|
|||
-rw-rw-r-- 1 furst furst 61 Mar 31 18:07 hello.c
|
||||
```
|
||||
|
||||
Something interesting happened: when we copy the files, they have new modification times. This might be undesirable for a backup. But I can *preserve* the old modification times with the `-p` option:
|
||||
Something interesting happened: when we copy the files, they have new modification times. This might be undesirable for a backup. But we can *preserve* the old modification times with the `-p` option:
|
||||
|
||||
```
|
||||
$ cp -rp foobar foobar_backup
|
||||
|
|
@ -176,9 +177,9 @@ Now change the permissions to make this script executable:
|
|||
$ chmod u+x weather.sh
|
||||
```
|
||||
|
||||
You now have a short script that downloads the latest weather forecast! Who needs the web!
|
||||
You now have a short script that downloads the latest weather forecast! Who needs a web browser?
|
||||
|
||||
macOS Easter egg: `./weather.sh | tail -n +15 | say`
|
||||
(Here's a macOS Easter egg: `./weather.sh | tail -n +15 | say`)
|
||||
|
||||
The shell script above shows how you can write your own Unix utility. It processes command options like the programs we've learned about and provides some user information, including fairly reasonable error processing.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue