Skip to content

Commit 77b62bc

Browse files
Add links now gets the second to last version.
1 parent 7ba5d28 commit 77b62bc

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

add_links.sh

100644100755
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
#!/usr/bin/env bash
22

33
### USAGE
4-
# add_links.sh major minor
5-
# Example:
6-
# add_links.sh 2 22
7-
8-
major="$1"
9-
minor="$2"
10-
11-
if [ -z "$major" ] || [ -z "$minor" ]
12-
then
13-
echo "Major, minor required."
14-
exit 0
15-
fi
16-
17-
directory="$major""_""$minor"
4+
# add_links.sh
5+
6+
cd docs
7+
# Count number of dirs in /docs
8+
docsDirsCount=`find . -mindepth 1 -maxdepth 1 -type d | wc -l`
9+
# Get last docs version
10+
# Substract functions-reference, reference-manual, stan-users-guide, current version and remove trailing /
11+
directory=`ls -d -- */ | sed -n "$(($docsDirsCount-4))"p | sed 's/.$//'`
12+
cd ..
1813

1914
mkdir docs/"$directory"_tmp
2015

0 commit comments

Comments
 (0)