[TxMt] Strange issues with a shell script for a bundle command

feek feekdiv at gmail.com
Wed Mar 9 20:31:34 UTC 2016


Hi all,

I've some strange issues with a shell script for a bundle command. Caused by
a "*" (Asterisk) at the end of the line. 

Description:

In a folder I've the following files:

test.md
AAA-some-text.md

The content of test.md is:



In my bundle script I do a lot with the file. One of the things is that I
want to grep the first Header. In this case "# A header with star AAA*".

The shell code is (only the code causing the issue):


#!/bin/bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && .
"${TM_SUPPORT_PATH}/lib/bash_init.sh"
cd ~/Desktop
contenttitle=`grep -m 1 '^#\{1\}' test.md`
echo $contenttitle


When running "grep -m 1 '^#\{1\}' test.md" in Terminal I get as expected the
first header "# A header with star AAA*", but running the script in TextMate
I get "# A header with star AAA-some-text.md". Really strange..... there is
a replacement of "AAA*" by the filename "AAA-some-text.md" (from the current
folder). And even when more files with "AAA" exist, they also come in the
result of the script. It seems like there is a listing of the directory
performed like "ls AAA*".

Is this a TextMate issue? Or do I something wrong?

Regards,
Feek

NB1: when escaping the * in the markdown file (like \*), the script is
performed right.
NB2: when the AAA* text is in the middle of the line (some text on the
right), the error persists.




--
View this message in context: http://textmate.1073791.n5.nabble.com/Strange-issues-with-a-shell-script-for-a-bundle-command-tp29834.html
Sent from the textmate users mailing list archive at Nabble.com.


More information about the textmate mailing list