Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

md5

macrumors newbie
Original poster
Hello,
I have a bash script,

how do I make selections? For example I start the script and if there is directory called "test" on the desktop how do I give a choice "Do you want to delete it? y/n"

thanks
 
Use the osascript command to execute AppleScript that presents a dialog and returns the result on its stdout or stderr. Read 'man osascript', then refer to any AppleScript tutorial on how to present simple dialogs.

Since AppleScript is typically framed as a "tell app "SomeAppHere" ..." series of statements, you can tell the app System Events to do things if you don't have any other app at hand. You can also browse and experiment with AppleScripts using Script Editor (Spotlight search for it). To get the scripting terms, command-shift-O will present a list of scriptable apps; choose System Events and dig in.

There are also other command-line runnable languages that can present a dialog. The ones that come to mind are more complex than osascript for a simple dialog, though.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.