1

I would like to create a command alarm which plays a song at a given time. Here is the bash file, alarm, I've unfortunately created:

#!/bin/bash

at $1
open /.../mysongs/sweetsong.mp3

but when I run alarm 0830 in my terminal, a job is created and the song immediately starts playing. Then when the time actually comes for the job to run, nothing happens. I've come to the conclusion that it comes down to my use of at. Any tips? Thanks!

1 Answer 1

2

According to man at:

The at utility shall read commands from standard input and group them together as an at-job, to be executed at a later time.

So you need to pass the command in to standard input (and Use More Quotes™):

at "$1" < 'open /.../mysongs/sweetsong.mp3'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.