Sponsored Content
Top Forums UNIX for Dummies Questions & Answers A Simple Clock, Well Maybe Not That Simple... Post 302833661 by Corona688 on Wednesday 17th of July 2013 02:49:25 PM
Old 07-17-2013
A fun little app, and works great here.

When you find yourself writing pages of nearly-identical if/then, though, and if you want to use this code for teaching -- it's really time to learn the case statement:

Code:
case "$char" in
:)        colon ;;
0)        zero  ;;
1)        one   ;;
...
esac

Fancier but less-friendly code:

Code:
                if [ "$char" == ":" ]
                then
                        colon
                else
                        # Functions are named d0 through d9
                        d$char
                fi


Last edited by Corona688; 07-17-2013 at 04:03 PM..
This User Gave Thanks to Corona688 For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ok simple question for simple knowledge...

Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies

2. Shell Programming and Scripting

Simple if

Hi, I have a variable (x) that holds a file name - I need to write this: if x matches the patern *ABC* or the pattern DEF*T then action A else action B fi how to do that? Also, how can i change the or test to AND test? Thanks. (2 Replies)
Discussion started by: GNMIKE
2 Replies

3. Programming

Simple C question... Hopefully it's simple

Hello. I'm a complete newbie to C programming. I have a C program that wasn't written by me where I need to write some wrappers around it to automate and make it easier for a client to use. The problem is that the program accepts standard input to control the program... I'm hoping to find a simple... (6 Replies)
Discussion started by: Xeed
6 Replies

4. Shell Programming and Scripting

Simple to you not simple to me pattern matchin help

hey all, im new and my first question is: say i have a word "blahblah" how do i get and replace the last letter of the word with say k, so replace the h with a k. However you cant just replace the h it has to change the LAST LETTER of the word. Cheers In advance. :b: (0 Replies)
Discussion started by: aleks001
0 Replies

5. Shell Programming and Scripting

Something simple, I think...

Hello to all, I have a very simple script that Ii run to CD into a specific directory. When I run it without a dot notation or shell notation (as a subshell, therefore), the script does not actually change the directory. But how do I avoid using the dot or shell notation and still be able to... (1 Reply)
Discussion started by: confutatis
1 Replies

6. Shell Programming and Scripting

need very simple help

i have a part of script that is not getting me what i want? Below the script count=5 count1=1 if then echo $count1 count1=`expr $count1 + 1` fi -------------------------------------------------------- The result i want is 1 2 3 4 5 But its giving me result as only 1. Plz help... (2 Replies)
Discussion started by: ali560045
2 Replies

7. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

8. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

9. Programming

Simple Chess Clock

I am trying to implement a simple chess clock. It should have the following options: start, stop, reset, read. Reset will set the time to zero Start will start the clock Stop will stop the clock My problem is that I want that start continues counting the time from the time it had when it... (6 Replies)
Discussion started by: kristinu
6 Replies
Pod::Simple::Wiki::Moinmoin(3pm)			User Contributed Perl Documentation			  Pod::Simple::Wiki::Moinmoin(3pm)

NAME
Pod::Simple::Wiki::Moinmoin - A class for creating Pod to Moinmoin wiki filters. SYNOPSIS
This module isn't used directly. Instead it is called via "Pod::Simple::Wiki": #!/usr/bin/perl -w use strict; use Pod::Simple::Wiki; my $parser = Pod::Simple::Wiki->new('moinmoin'); ... Convert Pod to a Moinmoin wiki format using the installed "pod2wiki" utility: pod2wiki --style moinmoin file.pod > file.wiki DESCRIPTION
The "Pod::Simple::Wiki::Moinmoin" module is used for converting Pod text to Wiki text. Pod (Plain Old Documentation) is a simple markup language used for writing Perl documentation. For an introduction to Moinmoin see: http://moinmoin.wikiwikiweb.de/ This module isn't generally invoked directly. Instead it is called via "Pod::Simple::Wiki". See the Pod::Simple::Wiki and pod2wiki documentation for more information. METHODS
Pod::Simple::Wiki::Moinmoin inherits all of the methods of "Pod::Simple" and "Pod::Simple::Wiki". See Pod::Simple and Pod::Simple::Wiki for more details. SEE ALSO
This module also installs a "pod2wiki" command line utility. See "pod2wiki --help" for details. ACKNOWLEDGEMENTS
Thanks to Michael Matthews for MoinMoin support. DISCLAIMER OF WARRANTY
Please refer to the DISCLAIMER OF WARRANTY in Pod::Simple::Wiki. AUTHORS
John McNamara jmcnamara@cpan.org COPYRIGHT
X MMIII-MMVIII, John McNamara. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. perl v5.10.1 2009-08-26 Pod::Simple::Wiki::Moinmoin(3pm)
All times are GMT -4. The time now is 11:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy