A Chess forum. ChessBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ChessBanter forum » Chess Newsgroups » rec.games.chess.computer (Computer Chess)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

yahoo2pgn - a linux shell script for converting Yahoo! Chess files to pgn



 
 
Thread Tools Display Modes
  #11  
Old January 18th 06, 04:54 AM posted to rec.games.chess.misc,rec.games.chess.computer,rec.games.chess.analysis
external usenet poster
 
Posts: n/a
Default yahoo2pgn - a linux shell script for converting Yahoo! Chess files to pgn

On 2006-01-18, primitiveworker wrote:
I'm usually content to simply get these kinds of quick-and-dirty
scripts to work and then forget them. Thank you very much for your
script-fu.


You're welcome.

Could you (or anyone else) please send me a sample game in Yahoo
format?

The date format that yahoo produces just happens to be exactly the
default output format of GNU's date -- "Tue Jan 17 20:59:41 MST 2006".


This converts it to PGN format without using an external command:

DATEYAHOO="Tue Jan 7 20:59:41 MST 2006"
set -- $DATEYAHOO
y=$6
m=$2
d=$3
PGNTIME=$4

## Convert month name to number
mm=JanFebMarAprMayJunJulAugSepOctNovDec
idx=${mm%%$m*}
m=$(( (${#idx} + 4 ) / 3 ))

## Pad month and day with 0 if necessary
case $m in ?) m=0$m ;; esac
case $d in ?) d=0$d ;; esac

PGNDATE=$y.$m.$d


--
Chris F.A. Johnson http://cfaj.freeshell.org
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
  #12  
Old February 5th 06, 04:48 AM posted to rec.games.chess.computer
external usenet poster
 
Posts: n/a
Default yahoo2pgn - a linux shell script for converting Yahoo! Chess files to pgn

In article ,
David Richerby wrote:


Ari Makela wrote:
Simon Krahnke wrote:
What is pure sh? I have no POSIX to cite, but my /bin/ash surely
supports functions, and almost all system scripts depend on that.


The original Bourne Shell is not POSIX compatible, is it? AFAIK it does
not have functions but I have not checked.


By ``pure sh'', I meant the original Bourne shell, yes. It isn't POSIX-
compliant because it predates POSIX by quite some time. I'm fairly sure
it doesn't have functions.

In this day and age, sh is usually a symlink to bash or something like it,


Only on Linux systems. FreeBSD, for example, still maintains a "pure"
Bourne shell as /bin/sh. Bash is available as a port.
--
Conrad J. Sabatier -- "In Unix veritas"
  #13  
Old February 5th 06, 04:49 AM posted to rec.games.chess.computer
external usenet poster
 
Posts: n/a
Default yahoo2pgn - a linux shell script for converting Yahoo! Chessfiles to pgn

In article ,
Simon Krahnke wrote:


* David Richerby (13:27) schrieb:

By ``pure sh'', I meant the original Bourne shell, yes. It isn't POSIX-
compliant because it predates POSIX by quite some time. I'm fairly sure
it doesn't have functions.


I'm fairly sure no one's using the original Bourne shell in 2006.


For interactive use, this is largely true. However, for system scripts and
such, the Bourne shell is still quite predominant.

--
Conrad J. Sabatier -- "In Unix veritas"
  #14  
Old February 6th 06, 10:57 AM posted to rec.games.chess.computer
external usenet poster
 
Posts: n/a
Default yahoo2pgn - a linux shell script for converting Yahoo! Chessfiles to pgn

Conrad J. Sabatier wrote:
Simon Krahnke wrote:
David Richerby (13:27) schrieb:
By ``pure sh'', I meant the original Bourne shell, yes. It isn't
POSIX-compliant because it predates POSIX by quite some time.
I'm fairly sure it doesn't have functions.


I'm fairly sure no one's using the original Bourne shell in 2006.


For interactive use, this is largely true. However, for system
scripts and such, the Bourne shell is still quite predominant.


But, as Simon points out, not the *original* Bourne shell. It turns
out you'd be hard pressed to find a Bourne shell without functions at
any time in the last twenty years.


Dave.

--
David Richerby Flammable Dangerous Projector (TM):
www.chiark.greenend.org.uk/~davidr/ it's like a 16mm film projector but
it could explode at any minute and it
burns really easily!
  #15  
Old February 8th 06, 08:19 AM posted to rec.games.chess.computer
external usenet poster
 
Posts: n/a
Default yahoo2pgn - a linux shell script for converting Yahoo! Chessfiles to pgn

* Conrad J. Sabatier (2006-02-05) schrieb:

David Richerby wrote:


By ``pure sh'', I meant the original Bourne shell, yes. It isn't POSIX-
compliant because it predates POSIX by quite some time. I'm fairly sure
it doesn't have functions.

In this day and age, sh is usually a symlink to bash or something like it,


Only on Linux systems. FreeBSD, for example, still maintains a "pure"
Bourne shell as /bin/sh. Bash is available as a port.


But they both support functions and other POSIX features, which the
original bourne shell did not have.

When writing a shell script in these days you can be sure, that the
/bin/sh running it will fairly POSIX compatible and support functions.
Unless you are writing for a computer museum.

End of discussion? This group is about computer chess, not shell
scripts.

mfg, simon .... l
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 January 3rd 06 06:04 AM
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 December 19th 05 05:36 AM
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 December 4th 05 05:29 AM
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 November 3rd 05 05:30 AM
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 October 19th 05 05:37 AM


All times are GMT +1. The time now is 10:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.Content Relevant URLs by vBSEO 2.4.0
Copyright ©2004-2010 ChessBanter.
The comments are property of their posters.