[TextMate] Custom Shell Variables question
Mats Persson
mats at imediatec.co.uk
Mon Oct 18 13:35:25 UTC 2004
On Oct 16, 2004, at 14:30, Allan Odgaard wrote:
>> Yes, however with the help of your suggestion and a bit of own brain
>> activity - a rare but appreciated event - I created a work around for
>> my system that works by using a custom shell variable that contains
>> the path to the Sites directory.
>>
>> echo $TM_SITES_DIRECTORY
>> /Volumes/WorkDisk/Users/mats/Sites
>
> Ah, yes -- I think that's really the only "general" solution, seeing
> how there is no way we can extract the “logical” project directory
> from the existing variables.
(With an embarrassed face)
Hmm, was a bit too cocky there thinking I understood this all. Which I
didn't of course.
Now having spent too much of the weekend trying to decipher the
incomprehensible 'english' of the man files, online tutorials etc etc.
I am still stuck and confused.
I am trying to create my own shell variable that is embedded in a new
file when it's created like this:
Creating a new file "/Users/mats/Sites/projectName/index.php" should
embed the variable TM_PROJ_FILEPATH which should be
"/projectName/index.php" into the newly created file.
So I am trying this inside a text doc in TM with no success. What's
wrong ??
TM_PROJ_FILEPATH=`$TM_FILEPATH | sed
"s|^$TM_SITES_DIRECTORY\(.*\)\$|\1|"`
echo $TM_PROJ_FILEPATH
/bin/sh: line 1:
/Volumes/WorkDisk/Users/mats/Sites/projectName/index.php: Permission
denied
( I have tried the above and any possible variation I could think of
with no success)
The template file command is:
[ -f "$TM_NEW_FILE" ] || TM_DATE=`date +%Y-%m-%d` TM_YEAR=`date +%Y`
TM_USERNAME=`niutil -readprop / /users/\$USER realname` perl -pe
's/\$\{([^}]*)\}/$ENV{$1}/g' <index.php >"$TM_NEW_FILE"
and in that command I would like to add the new variable value
TM_PROJ_FILEPATH.
>> In the template I use ${TM_FILEPATH} and when I create a new template
>> TM_FILEPATH takes the value of the currently selected Tab in the Tab
>> bar.
> You should use TM_NEW_FILE instead :)
Yeah, I told you I was embarrassed. : )
>> Do you have any recommendations about good resources for learning
>> that stuff, books or online ? How did you grasp it all ?
> <SNIP>
> Personally I don't mind unix questions sent to this list, since
> TextMate is so tied to shell stuff.
Be careful with what you don' t mind. Someone might take you up on it.
: )
Attn: Andre. Thanks for those links and recommendations.
Perhaps I could suggest that you guys who know and understand this
stuff could create a ShellScriptCorner on the wiki where you could
translate the incomprehensible stuff into examples and ENGLISH for us
non-geek's. Because the writers of man files and online UNIX guides
sure as hell hasn't.
Apologies, but I *HATE IT* when I can't work something out myself. AND
the only reason that I can't do it is that the people who have created
the problem assumed that I - or anyone else - knows as much as they do,
and therefore see logic when there is none.
Kind regards,
Mats
More information about the textmate
mailing list