21 lines
637 B
Bash
Executable File
21 lines
637 B
Bash
Executable File
#!/bin/bash
|
|
|
|
FILEDIRNAME=$1
|
|
FILE=$2
|
|
echo "fileDirname : $FILEDIRNAME"
|
|
echo "file : $FILE"
|
|
|
|
if [ ${FILE: -4} == ".tex" ]; then
|
|
cd "$FILEDIRNAME"
|
|
FILE=${FILE##*/} # remove directory path from filename
|
|
makeindex "${FILE%.tex}.idx" > ~/.vscode/.makeindex_log # ${FILE%.tex}.idx replaces .tex ending with .idx
|
|
if [ $? == 0 ]; then # check success status (return value) of the last command (pdflatex)
|
|
echo -e "\033[32mCreated \"${FILE%.*}.idx\" successfully.\033[0m";
|
|
else
|
|
cat ~/.vscode/.makeindex_log
|
|
echo -e "\033[31mERROR: Make Index for \"${FILE}\" failed.\033[0m";
|
|
fi
|
|
else
|
|
echo "$FILE is not a *.tex file."
|
|
fi
|