]> granicus.if.org Git - multimarkdown/commitdiff
FIXED: Fix PATH in convenience scripts
authorRyan Schmidt <git@ryandesign.com>
Fri, 7 Sep 2018 23:54:30 +0000 (18:54 -0500)
committerRyan Schmidt <git@ryandesign.com>
Sat, 8 Sep 2018 00:13:37 +0000 (19:13 -0500)
Add the convenience script's directory to PATH, on the assumption that
the multimarkdown executable is in the same directory.

Remove $PWD from PATH, because there's no reason why we should expect
the user's shell to have been changed to the directory that contains
multimarkdown.

export PATH separately from setting PATH, because older shells can't do
both at once.

unset CDPATH because if a user had exported it, it could change the
behavior of cd.

scripts/markdown
scripts/mmd
scripts/mmd2all
scripts/mmd2epub
scripts/mmd2fodt
scripts/mmd2odt
scripts/mmd2opml
scripts/mmd2pdf
scripts/mmd2tex

index f59c5db80c7faab05fda6d37e6fb8925f606002e..19a0d3973836a7afe8127511e9bd1bafe726deac 100755 (executable)
@@ -8,7 +8,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index 6f37362b731a7cba61d62b6713fe07bd18701153..a1a6aa7a1003ce93e2b385964b220964a0f04518 100755 (executable)
@@ -8,7 +8,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index 94b89875156f8080780750b387069beca804393e..0c12310b9486af8150d689cfa3a1f3e1693352ba 100755 (executable)
@@ -9,7 +9,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index 11f77976d58163c544c29bdabd03811a53b1e21e..7643541d4f4d0b1eea655b18d1161dc58fb315cb 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# mmd2oepub --- MultiMarkdown convenience script
+# mmd2epub --- MultiMarkdown convenience script
 #      <http://fletcherpenney.net/multimarkdown/>
 #      Fletcher T. Penney
 #
@@ -8,7 +8,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index 64258d1114dd004b684461a942b022c32c80d85a..745755bc1ef1e5e7ff09570e977335d53ebb15ec 100755 (executable)
@@ -8,7 +8,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index a0acc66af770d92d7647c6674849e936a2e17933..f8985c6770e2c18cbb39680d69fbecab7622f14c 100755 (executable)
@@ -8,7 +8,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index 7ffa149ed45c9f0a5691717438c0b4fa2d87e519..c4b9ed648a4bd5e16689a461e735562c287b563f 100755 (executable)
@@ -8,7 +8,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index 1afe5a58a7f9feeb49beec37b22730dbe7287479..d8463a675564e308c075aeee1b36d6945e99fea5 100755 (executable)
 #              LaTeX file.
 
 # Be sure to include multimarkdown and latex in our PATH
-export PATH="$PWD:/usr/local/bin:/usr/texbin:/Library/TeX/texbin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:/usr/texbin:/Library/TeX/texbin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]
index 2cac18d0777856bc684f7b8a01b0c521af0987bf..317ba75c5c940ce858f9803e8cf59bba1e197f90 100755 (executable)
@@ -8,7 +8,17 @@
 #
 
 # Be sure to include multimarkdown in our PATH
-export PATH="$PWD:/usr/local/bin:$PATH"
+unset CDPATH
+SCRIPT="$0"
+while
+       DIR="$(cd -P -- "$(dirname -- "$SCRIPT")" && pwd)"
+       test -h "$SCRIPT"
+do
+       SCRIPT="$(readlink "$SCRIPT")"
+       [ "$SCRIPT" = "${SCRIPT#/}" ] && SCRIPT="$DIR/$SCRIPT"
+done
+PATH="$DIR:/usr/local/bin:$PATH"
+export PATH
 
 which multimarkdown > /dev/null
 if [ $? = 1 ]