Skip to content

Commit ca13c65

Browse files
Qualousmwolbrink
authored andcommitted
Correct BaseName Handling for Spaces in Path
This corrects "basename: extra operand ‘VAL1’" errors as seen below. Also this moves the basename call to only occur when the help text is displayed. > $ '/cygdrive/c/Users/myusername/OneDrive - VAL1 VAL2/Utils/github-markdown-toc/gh-md-toc' --help > /cygdrive/c/Users/myusername/OneDrive - VAL1 VAL2/Utils/github-markdown-toc/gh-md-toc > basename: extra operand ‘VAL1’ > Try 'basename --help' for more information. > GitHub TOC generator (): 0.5.0 > > Usage: > [--insert] src [src] Create TOC for a README file (url or local path) > - Create TOC for markdown from STDIN > --help Show help > --version Show version
1 parent aba04da commit ca13c65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gh-md-toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ gh_toc_get_filename() {
201201
# Options hendlers
202202
#
203203
gh_toc_app() {
204-
local app_name=$(basename $0)
205204
local need_replace="no"
206205

207206
if [ "$1" = '--help' ] || [ $# -eq 0 ] ; then
207+
local app_name=$(basename "$0")
208208
echo "GitHub TOC generator ($app_name): $gh_toc_version"
209209
echo ""
210210
echo "Usage:"

0 commit comments

Comments
 (0)