From a22ff75e023034068d07adae2ebc427607b24b5d Mon Sep 17 00:00:00 2001 From: Einhard Leichtfuß Date: Sun, 23 Dec 2018 07:06:00 +0100 Subject: Simplify and abstract from "$tmp" - Add input and write to basic.sh to no longer need to know "$tmp" in the calling scripts. Also, - make runnable from outside the directory containing the scripts, - simplify chained grep and sed commands. --- basic.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'basic.sh') diff --git a/basic.sh b/basic.sh index 77d893b..891d9c5 100644 --- a/basic.sh +++ b/basic.sh @@ -47,6 +47,20 @@ function init tmp_="$tmp_d/b" } +# $1: file to treat as input: filename +# requires: init to be run +function input +{ + cp "$1" "$tmp" +} + +# $1: file to write to: filename +# requires: init and input to be run +function write +{ + cp "$tmp" "$1" +} + function cleanup { rm -rf "$tmp_d" -- cgit v1.2.3