#!/bin/bash #shTunes - control iTunes through the shell themenu() { echo "shTunes: Please enter one of:" echo "L: Next track" echo "H: Previous track" echo "P: Play/Pause" echo "S: Stop" echo "Q: Quit shTunes" echo echo "Type the letter and press enter"; } while true do themenu read choice case $choice in l|L) osascript -e 'tell application "iTunes" to play (next track)';; h|H) osascript -e 'tell application "iTunes" to play (previous track)';; p|P) osascript -e 'tell application "iTunes" to playpause';; s|S) osascript -e 'tell application "iTunes" to stop';; q|Q) break;; *) echo "Enter a valid response next time, please";; esac done