catch [list exec find /home/gusman/mp3 -name "*$title*" -type f -printf "%f,"] song
I cut and divide in this way:
regsub -all "," $song "\n" song
And post them this way
putserv "notice $nick :$song"
The result only posts one line
<Botnick>: Title song.mp3
Whereas in the search file there are several song titles
I want to post it like this:
<Botnick>:1 Title song.mp3
<Botnick>:2 Title song.mp3
<Botnick>:3 Title song.mp3
according to the number of search results.
Why do you print with the extra ,
characters and replace them afterwards with newlines, instead of using newlines directly?
I guess you're also missing a split
and a foreach
loop.
This works for me:
catch [list exec find /home/gusman/mp3 -name "*$title*" -type f] songs
foreach song [split $songs \n] {
putserv "notice $nick :$song"
}