2

I want to develop custom git command using tcl. The choice of programming language was done considering ease of learning (as I thought) and availability (git ships with tcl).

I want to create folder using tcl script. Normally I'm calling mkdir <name> in the script and it works fine, but in case if it git command it is saying: invalid command name "mkdir".

Am I missing some references to be added to my script to make system commands available for me?

The strange thing, that exec sh is working. But I don't want to wrap mkdir into sh... Or is this the only way in my case?

shytikov
  • 9,155
  • 8
  • 56
  • 103

1 Answers1

4

Try using file mkdir dir ?dir ...?.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
Ashot
  • 10,807
  • 14
  • 66
  • 117
  • Magic! Thanks! I didn't imagine that folder manipulation will be grouped with file manipulation in `tcl`... http://www.tcl.tk/man/tcl/TclCmd/file.htm#M22 – shytikov Nov 25 '12 at 20:27
  • 3
    @shytikov While Tcl does do some (deeply gnarly) magic in interactive use to make a direct `mkdir` work, for a script that's disabled (because it can cause surprises with some inputs). The directory creation is in `file` because there's no `directory` command. :-) – Donal Fellows Nov 26 '12 at 00:20