Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit6e188687a433c6945f9e4136baf5c7b6a6816401 (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-07-22 16:24:59 +0300
Committer
 Syndamia <kamen@syndamia.com>
2024-07-22 16:24:59 +0300
Files2f0b0002d64cf182f087961b13cb4287f3a3e9f0
csg-6e188687a433c6945f9e4136baf5c7b6a6816401.tar
csg-6e188687a433c6945f9e4136baf5c7b6a6816401.tar.gz
csg-6e188687a433c6945f9e4136baf5c7b6a6816401.zip
Parent67a6a6a96db43a15bfdf27166cdad678c78ba38f (diff)
(csg) Allowed csg to be ran from other directories
1 files changed, 4 insertions, 2 deletions
-rwxr-xr-xcsg6
diff --git a/csg b/csg
index 2a0e452..9321292 100755
--- a/csg
+++ b/csg
@@ -68,6 +68,8 @@ USERAWKDIR="$5"
### Preprocessing 3
### "Global" variables
+CSG_DIR="$(dirname "$0")"
+
: ${CSG_TMP_DIR:='/tmp'}
[ ! -d "$CSG_TMP_DIR" ] && echo "[Error] $CSG_TMP_DIR (\$CSG_TMP_DIR) doesn't exist!" \
&& csg_help 1
@@ -109,7 +111,7 @@ EOF
echo 'BEGIN { FILENAME=ARGV[1];FIRST="f";ALL="a"' > "$CSG_TMP_DIR/meta.begin.awk"
while read -r file
do
- $CSG_AWK -f meta.awk "$file" >> "$CSG_TMP_DIR/meta.begin.awk" &
+ $CSG_AWK -f "$CSG_DIR/meta.awk" "$file" >> "$CSG_TMP_DIR/meta.begin.awk" &
done << EOF
$(find "$DESTINATION" -type f -name "*.md")
EOF
@@ -125,7 +127,7 @@ convert_file() {
$CSG_AWK \
-f "$CSG_TMP_DIR/meta.begin.awk" -f "$USERAWKDIR/user.begin.awk" \
- -f lib_stack.awk -f single.awk \
+ -f "$CSG_DIR/lib_stack.awk" -f "$CSG_DIR/single.awk" \
"$file" > "$outf"
rm "$file"
}