Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replacing external programs with bash builtins

* Dirname can be done with parameter expansion
* All variables should be quoted to avoid wordsplitting
** http://mywiki.wooledge.org/BashFAQ/028
  • Loading branch information...
commit 117b03f369ec24f307122998a3a96c3a83238293 1 parent fe4eb3d
@bahamas10 authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 bin/mad
View
8 bin/mad
@@ -3,7 +3,7 @@
VERSION="0.4.0"
REMOTE=git://github.com/visionmedia/mad-pages.git
REMOTE_MAD=git://github.com/visionmedia/mad.git
-CONFIG=$(dirname $0)/../etc/mad.conf
+CONFIG=${0%/*}/../etc/mad.conf
MAD_CONFIG=${MAD_CONFIG:-$CONFIG}
shopt -s nocasematch
@@ -42,7 +42,7 @@ list_pages() {
display() {
IFS=":"
local page=$1
- local paths=".:$MAD_PATH:$(dirname $0)/../share/mad:/usr/share/mad"
+ local paths=".:$MAD_PATH:${0%/*}/../share/mad:/usr/share/mad"
for path in $paths; do
local file=$path/$page
@@ -105,7 +105,7 @@ display_file() {
#
display_mad_usage() {
- display_file $(dirname $0)/../share/mad/mad.md
+ display_file "${0%/*}/../share/mad/mad.md"
exit
}
@@ -114,7 +114,7 @@ display_mad_usage() {
#
install_all_remote() {
- local path=$(dirname $0)/../share/mad
+ local path=${0%/*}/../share/mad
echo
echo " ... cloning repo"
cd /tmp && rm -fr mad-pages
Please sign in to comment.
Something went wrong with that request. Please try again.