first implémentation - frsh - french command language interpreter
HTML git clone git://bitreich.org/frsh git://hg6vgqziawt5s4dj.onion/frsh
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
DIR commit 902528c972890ffb432d1123063ee656ec91a37a
HTML Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sat, 10 Aug 2024 15:50:06 +0200
first implémentation
Diffstat:
A Makefile | 39 +++++++++++++++++++++++++++++++
A README | 24 ++++++++++++++++++++++++
A frsh | 27 +++++++++++++++++++++++++++
A frsh.1 | 33 +++++++++++++++++++++++++++++++
A test.frsh | 3 +++
5 files changed, 126 insertions(+), 0 deletions(-)
---
DIR diff --git a/Makefile b/Makefile
@@ -0,0 +1,39 @@
+.POSIX:
+
+NAME = frsh
+VERSION = 0.1
+
+# paths
+PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/share/man
+
+MAN1 = ${NAME}.1
+BIN = ${NAME}
+
+options:
+ @echo make targets:
+ @echo - test
+ @echo - install
+ @echo - uninstall
+
+test: test.frsh
+ @if test "$$(./${BIN} test.frsh)" = "bojour"; then \
+ echo parfait; \
+ else \
+ echo kaput; \
+ exit 1; \
+ fi
+
+install:
+ mkdir -p ${DESTDIR}${PREFIX}/bin
+ cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
+ chmod 755 ${DESTDIR}${PREFIX}/bin/${BIN}
+ mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1/${MAN1}
+ chmod 644 ${DESTDIR}${MANPREFIX}/man1/${MAN1}
+
+uninstall:
+ rm -f ${DESTDIR}${PREFIX}/bin/${BIN}
+ rm -f ${DESTDIR}${MANPREFIX}/man1/${MAN1}
+
+.PHONY: options test install uninstall
DIR diff --git a/README b/README
@@ -0,0 +1,24 @@
+NAME
+ frsh – french command language interpreter
+
+SYNOPSIS
+ frsh [file ...]
+
+DESCRIPTION
+ The frsh utility is a french command language intertreter: it reads one
+ or more commands, either from the commmand line or from a french file (a
+ french shell script), and then sets about executing those commands. Thus
+ it is the main interface between the french user and the operating
+ system.
+
+ In contrast to the anglaise sh(1), it supports french quotes for strings
+ (« and «). Furthermore, variable values are retrieved using the syntax
+ €variable.
+
+ Options: Non.
+
+SEE ALSO
+ sh(1)
+
+AUTHORS
+ Anders Damsgaard <anders@adamsgaard.dk>
DIR diff --git a/frsh b/frsh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# french command language interpreter
+
+SHELL="${0}"
+
+frenchtranslate() {
+ sed 's/«/"/g;s/»/"/g;s/€/$/g'
+}
+
+promptprint() {
+ printf '%s' "${USER}@$(hostname):${PWD} € "
+}
+
+if test $# -gt 0
+then
+ for f in "$@"
+ do
+ eval "$(frenchtranslate <"$f")"
+ done
+else # interactive shell
+ promptprint
+ while read -r l
+ do
+ eval $(echo "$l" | frenchtranslate)
+ promptprint
+ done
+fi
DIR diff --git a/frsh.1 b/frsh.1
@@ -0,0 +1,33 @@
+.Dd $Mdocdate$
+.Dt FRSH 1
+.Os
+.Sh NAME
+.Nm frsh
+.Nd french command language interpreter
+.Sh SYNOPSIS
+.Nm
+.Op Ar file ...
+.Sh DESCRIPTION
+The
+.Nm
+utility is a
+.Em french command language intertreter :
+it reads one or more commands,
+either from the commmand line or from a french file
+(a french shell script),
+and then sets about executing those commands.
+Thus it is the main interface between the french user and the
+operating system.
+.Pp
+In contrast to the anglaise
+.Xr sh 1 ,
+it supports french quotes for strings (« and «).
+Furthermore, variable values are retrieved using the syntax
+.No € Ns Ar variable .
+.Pp
+Options:
+Non.
+.Sh SEE ALSO
+.Xr sh 1
+.Sh AUTHORS
+.An Anders Damsgaard Aq Mt anders@adamsgaard.dk
DIR diff --git a/test.frsh b/test.frsh
@@ -0,0 +1,3 @@
+#!/bin/frsh
+var=«bojour»
+echo «€{var}»