summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouie Shprung <lshprung@scu.edu>2022-11-25 13:49:33 -0800
committerLouie Shprung <lshprung@scu.edu>2022-11-25 13:51:01 -0800
commitfe9abb684d2562e83b593b8b82b3bf98b08634b5 (patch)
treea48ba6afc160cd99042b7fda8524df661580a807
parent16dde4863dd9327f74cadab2a5f05d09bc467e50 (diff)
Fixed 3X links
-rwxr-xr-xgetters/ncurses.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/getters/ncurses.sh b/getters/ncurses.sh
index bf8eba1..2939937 100755
--- a/getters/ncurses.sh
+++ b/getters/ncurses.sh
@@ -37,7 +37,21 @@ get_source() {
# Copy files to source
get_source | while read -r line; do
unset CATEGORY
- CATEGORY="$(basename "$(dirname "$line")")"
- mkdir -p "$DESTINATION/$CATEGORY"
- cp "$line" "$DESTINATION/$CATEGORY"
+ unset XCATEGORY
+ CATEGORY="$(echo "$line" | grep -Eo "[0-9][^.]*\.gz$" | sed 's/\.gz$//')"
+
+ # Check if the category is NX (e.g., 3ncurses -> 3X)
+ if [ $(echo "$CATEGORY" | wc -m) -gt 2 ]; then
+ XCATEGORY="$(echo "$CATEGORY" | cut -c -1)X"
+ fi
+
+ # Copy file, and rename if necessary
+ if [ -n "$XCATEGORY" ]; then
+ mkdir -p "$DESTINATION/man$XCATEGORY"
+ cp "$line" "$DESTINATION/man$XCATEGORY/$(basename "$line" | sed "s/$CATEGORY/$XCATEGORY/")"
+ else
+ mkdir -p "$DESTINATION/man$CATEGORY"
+ cp "$line" "$DESTINATION/man$CATEGORY"
+ fi
+
done