SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2009-11-09 20:38:06

Savonlinna
Member
From: Sweden
Registered: 2009-05-19
Posts: 35

[SOLVED] Script echo help

I'm usually running foobar with a "countdown-to-kill-playback" component when I go to bed (love mah soft tunes! smile ), but I'm in the middle of moving, so I'm stuck with my laptop for now. I still want to do the whole timed playback killing though, so I thought I'd just do this:

#!/bin/sh
sleep 90m
killall exaile &

I'm sure it's not the cleanest way to do it, but it gets the job done. The problem is I'd also like to have it echo the remaining time. Anyone have a smooth way of doing this?

Edit:
If all else fails, I'll (sort of) happily settle for having it echo a static countdown, but I'm guessing that'll be just as tricky, since if I'm not mistaken "sleep" will halt all activity in the script until the set time runs out, no?

Edit2:
I just thought of something; if I place a 90m countdown first in the script, will it actually wait the allotted time before executing the following line(s)? If so, wouldn't that make using "sleep" unnecessary?

Last edited by Savonlinna (2009-11-09 21:15:36)


"History is the fiction we invent to persuade ourselves that events are knowable and that life has order and direction."

Offline

Be excellent to each other!

#2 2009-11-09 21:02:07

benj1
Wiki Wizard
From: Yorkshire, England
Registered: 2009-09-05
Posts: 1,084

Re: [SOLVED] Script echo help

i would have thought the best approach would be something like

for a in $(seq 90 -1 0); do echo $a "minutes left"; sleep 60s; done

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Offline

#3 2009-11-09 21:15:20

Savonlinna
Member
From: Sweden
Registered: 2009-05-19
Posts: 35

Re: [SOLVED] Script echo help

Thanks benj1, works like a charm!


"History is the fiction we invent to persuade ourselves that events are knowable and that life has order and direction."

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo