SEARCH

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

You are not logged in.

#1 2012-05-08 22:46:51

lurka
New Member
From: New York
Registered: 2012-04-20
Posts: 8

Baby Level 99: Shell Script Greeting using Cowsay and date

#!/bin/bash
COW_PATH=/usr/share/cows

files=($COW_PATH/*.cow)    
N=${#files[@]}
((N=RANDOM%N))
cow=${files[$N]}


h=`date +%H`
case $h in
    0[0-9]|1[0-1]) greeting="Good morning!"
    ;;
    1[2-9]) greeting="Good afternoon!"
    ;;
    2[0-4]) greeting="Good evening!"
    ;;
esac

cowsay -f $cow $greeting

exit 0


Tip: May need to modify COW_PATH- This was tested on Arch Linux.

Last edited by lurka (2012-05-08 22:56:56)

Offline

Help fund CrunchBang, donate to the project!

#2 2012-05-09 07:36:59

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Baby Level 99: Shell Script Greeting using Cowsay and date

moo! what are the different cows?

Offline

#3 2012-05-09 07:43:56

machinebacon
#! unstable
From: PRC
Registered: 2009-07-02
Posts: 6,212
Website

Re: Baby Level 99: Shell Script Greeting using Cowsay and date

^ Morning Rho!

ls /usr/share/cowsay/cows/

Start Distrohopping here! -> Break your own... cool  VSIDO  cool LinuxCNC  kiss Frugalware <- It's all just a kernel.

Offline

#4 2012-05-09 07:52:07

Awebb
The Singularity
Registered: 2009-07-23
Posts: 2,812

Re: Baby Level 99: Shell Script Greeting using Cowsay and date

Congratulations on your first AI.


I'm so meta, even this acronym

Offline

#5 2012-05-09 21:48:05

lurka
New Member
From: New York
Registered: 2012-04-20
Posts: 8

Re: Baby Level 99: Shell Script Greeting using Cowsay and date

Congratulations on your first AI.

That's what people always say! D:

hah

Offline

#6 2012-05-09 21:57:19

Awebb
The Singularity
Registered: 2009-07-23
Posts: 2,812

Re: Baby Level 99: Shell Script Greeting using Cowsay and date

And every time they do, 2ct are sent to numbered account in Switzerland.


I'm so meta, even this acronym

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