Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminal scripting in OSX

I've never created a script before and am looking for a tutorial on writing a script for OSX 10.6. There is a terminal command that can show all hidden files. It's

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Changing TRUE to FALSE will hide system files. I want to make a script that checks the value of AppleShowAllFiles, and if TRUE, writes FALSE, and if FALSE, writes TRUE.

Is this done in TextEdit and saved as a .sh file? Can a script be something I double-click that just runs, or do I have to start terminal and type a command to execute the script? I'm a newb, sorry

Thanks guys

like image 557
Daddy Avatar asked Nov 15 '10 17:11

Daddy


1 Answers

You can use the .command extension to turn it into something you can click on. Just be sure to save it as text-only (Format -> Make Plain Text in TextEdit).

like image 80
Jeff Kelley Avatar answered Oct 06 '22 00:10

Jeff Kelley