All Modules / Module 8 / Lesson 2 of 4

Scripts as saved intent, not code

5 minute read

Create a Simple Script

Let's create a script that tells you useful info about your Mac.

1

Create the file:

touch ~/myinfo.sh
2

Open it in TextEdit:

open -e ~/myinfo.sh
3

Add these lines:

#!/bin/zsh echo "Current folder:" pwd echo "" echo "Files here:" ls
4

Save and close TextEdit

What's #!/bin/zsh? This first line (called a "shebang") tells your Mac which program should run the script. For Mac, use zsh.

Key Takeaway

Scripts start with #!/bin/zsh and contain commands, one per line.