From a1e724924bd84c7c59b45026d47a77df631caad5 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Fri, 10 May 2024 20:09:35 +0100 Subject: [PATCH] play around with bash/unix utilities --- README.md | 15 +++++++++++++++ f.sh | 9 +++++++++ log.f | 8 ++++++++ model.f | 2 ++ 4 files changed, 34 insertions(+) create mode 100644 README.md create mode 100755 f.sh create mode 100644 log.f create mode 100644 model.f diff --git a/README.md b/README.md new file mode 100644 index 0000000..a831ddd --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +To do: + +- [ ] Write README +- [ ] Add show more info version +- [ ] Add division? +- [ ] Read from file? +- [ ] Save to file? +- [ ] Program into a small device, like a calculator? +- [ ] Allow comments? + - Use a sed filter? + + +go run main.go < model.f +sed 's|//||' model.f | go run main.go + diff --git a/f.sh b/f.sh new file mode 100755 index 0000000..f581adb --- /dev/null +++ b/f.sh @@ -0,0 +1,9 @@ +#!/bin/bash +#while IFS= read -r line; do echo "$line" | sed 's| //.*||' | go run main.go + +# while IFS= read -r line; do echo "$line" | sed 's|//.*||'; done | go run main.go + + +sed -u 's|//.*||' | go run main.go +# ^ sed unbuffered. +# cat | tee -a log.f | sed -u 's|//.*||' | go run main.go | tee -a log.f diff --git a/log.f b/log.f new file mode 100644 index 0000000..60c2765 --- /dev/null +++ b/log.f @@ -0,0 +1,8 @@ +1 10 +=> 1.0 10.0 +1 100 +=> 2.4 415.0 +1 100 // +=> 1.0 100.0 +1 10 // hello world +=> 2.4 415.0 diff --git a/model.f b/model.f new file mode 100644 index 0000000..cdc8a99 --- /dev/null +++ b/model.f @@ -0,0 +1,2 @@ +1 10 +2 20