Bash-Alarm-Clock

It is an alarm clock created using Bash Scripting.

Here are the step-by-step instructions to create a bash script for an alarm clock playing music:

# Get the current time
current_time=$(date +"%H:%M")
# Play the music file when the alarm goes off
play file.mp3
#!/bin/bash

alarm_time="18:30"

current_time=$(date +"%H:%M")

while true; do
    current_time=$(date +"%H:%M")
    if [ "$current_time" \> "$alarm_time" ]; then
        break
    fi
    sleep 60
done

play file.mp3

chmod +x alarm.sh
./alarm.sh: line 16: play: command not found

then the error message you are seeing (./alarm.sh: line 16: play: command not found) indicates that the play command is not found on your system.

The play command is part of the sox package, which may not be installed on your system by default. You can install it using your distribution’s package manager.

For example, if you are using Ubuntu or Debian, you can install the sox package using the following command:

sudo apt-get install sox
play WARN alsa: can't encode 0-bit Unknown or not applicable
play FAIL formats: no handler for file extension `mp3'

To resolve this error, you can install the libsox-fmt-mp3 package, which contains the MP3 handler plugin. You can install it on Ubuntu or Debian using the following command:

sudo apt-get install libsox-fmt-mp3

output