#!/bin/csh ############################################################### # This script switches the playing mode from inorder to oldest # to random. It basically changes the setting that is stored # in the play_mode file in the state directory, so that the # musicbox_play.txt program will use that new mode the next # time it plays a song. ############################################################## ############################################################## # Find out what mode we are in now. If there is not a mode # file, then hop into inorder. Otherwise, advance from inorder # through random through oldest and back. If the mode is in # some garbled state, then switch to inorder. set old_mode = `musicbox_report_play_mode.txt` if ( inorder == "$old_mode" ) then set new_mode = random else if ( random == "$old_mode" ) then set new_mode = oldest else if ( oldest == "$old_mode" ) then set new_mode = inorder else echo "Unrecognized mode: $old_mode" set new_mode = inorder endif # Delete the old mode file (if any) and store the new mode. set modestate_file = `musicbox_state_directory.txt`/play_mode \rm -f "$modestate_file" echo $new_mode > "$modestate_file" ############################################################## # Interrupt any playing song and play the new-mode sound. musicbox_interrupt_to_say.txt "$new_mode".wav exit 0