1
bind pub "-|-" !tests pub:tests
proc pub:tests { nick host handle channel arg } {

set size [ exec ls -l /home/archiv/pics/*.r* | wc -l ]
putnow "PRIVMSG $channel :size $size"

}

I have this error

[09:36:19] Tcl error: 0
ls: cannot access '/home/archiv/pics/*.r*': No such file or directory

when i test in bash working this

ls -l /home/archiv/pics/*.r* |wc -l
result:
71

how can use .r (wildcard)? what is wrong? dir is correct, acces is correct. thx to help.

Regards

Jerry
  • 70,495
  • 13
  • 100
  • 144

1 Answers1

1

You sense correctly: Tcl's [exec] does not provide for bash-like wildcard expansion. Tcl can do this more easily for you, without [exec]'ing out, by using its [glob] and [llength] commands:

 set size [llength [glob "/home/archiv/pics/*.r*"]]

If you still prefer some other shell over Tcl (e.g., bash), then you have to [exec] into the shell explicitly, e.g.:

 set size [exec bash -c "ls -l /home/archiv/pics/*.r* | wc -l"]
mrcalvin
  • 3,291
  • 12
  • 18