Tiny Core Linux

Off-Topic => Off-Topic - Tiny Core Lounge => Topic started by: remus on December 31, 2011, 08:05:46 AM

Title: Happy New Year :)
Post by: remus on December 31, 2011, 08:05:46 AM
Happy new year Every ONE !!  ;D
55min to 2012 from Brisbane, Australia
Title: Re: Happy New Year :)
Post by: Rich on December 31, 2011, 08:26:45 AM
Happy new year to all.
Title: Re: Happy New Year :)
Post by: thane on December 31, 2011, 03:39:00 PM
Happy New Year! Although I'm near Honolulu so there's 13+ hours to go...
Title: Re: Happy New Year :)
Post by: Lee on December 31, 2011, 05:24:19 PM
+1 on the "Happy New Year!"
Title: Re: Happy New Year :)
Post by: coreplayer2 on December 31, 2011, 06:45:46 PM
Good Luck and a Happy New Year to All

Only 8+ hours and counting...

Code: [Select]
#!/bin/bash
#my simple countdown
#
. /etc/init.d/tc-functions
num=28800
while (( num > 0 ))
do
clear
echo -n "${CYAN}Countdown to 2012: ${GREEN}$num${NORMAL}"
sleep 1
let num-=1
clear
done

echo "Hoora!!"
Title: Re: Happy New Year :)
Post by: Lee on January 01, 2012, 01:48:34 PM
Cogratulations coreplayer2.  You are the first one to teach me something cool this year.  I have so often wished for the -= operator but, since I typically don't use "let", I never new it was there.  I guess one of the long term hazards of BASIC-as-a-first-language is the deeply ingrained notion that "VAR=VALUE" is exactly the same as "let VAR=VALUE", which clearly is not the case in shell scripting.

Code: [Select]
num=`expr ${NUM} \- 1`

Code: [Select]
let num-=1

Thanks for demonstrating such a useful tool.
Title: Happy New Year :)
Post by: coreplayer2 on January 04, 2012, 07:11:22 PM
Ha ha!  Your welcome, glad it was enlightening.  Am trying to learn bash as fast as possible, btw this "let" which I found quite interesting, was able to use on a project I'm currently working on.  So whilst it was still fresh in mind wrote a countdown the new year.