Commands; More than 1,000 that can be called from terminal and or scripts
/bin
/sbin
/usr/bin
/usr/sbin
3rd Party tools
/usr/local/bin/jamf
Begin Script with She-Bang
(!#)
Variables are fill-in the blanks; placeholders for information that will come later
Conditionals, If/Then Statements – Decision Makers
Gist Here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set directories | |
plex_media_folder="/Users/Teddy/Desktop/Plex Media" | |
movies_folder="/Users/Teddy/Movies" | |
# Find and remove .ts files older than 7 days | |
find "${plex_media_folder}" -type f -name "*.ts" -mtime +7 -exec rm {} \; | |
find "${movies_folder}" -type f -name "*.ts" -mtime +7 -exec rm {} \; | |
echo "Old Plex media files removed successfully." | |
# This empty's the trash can | |
osascript -e 'tell application "Finder" to empty the trash' |
EOF
Scripting 201 Gists
Link
https://youtu.be/UQs7-N2_35k
Scripts Used in Webinar
https://github.com/jamf/Scripting-101-Webinar
Jam Pro Scripting 201 Video