| View previous topic :: View next topic |
| Author |
Message |
topdawg_b Voice
Joined: 07 Dec 2008 Posts: 32
|
Posted: Tue Dec 09, 2008 11:00 pm Post subject: using bind to remove a file |
|
|
I have instruction files i allow people to make. People make mistakes. I need a command that deletes a file. Ive looked. I havent found one yet. I found 1 to remove a directory but not a file
i want to use pubm -|- !remfile del:file then put the command in my proc
thanks |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
|
| Back to top |
|
 |
topdawg_b Voice
Joined: 07 Dec 2008 Posts: 32
|
Posted: Wed Dec 10, 2008 9:37 am Post subject: |
|
|
| that's what i was looking for ty very much. |
|
| Back to top |
|
 |
topdawg_b Voice
Joined: 07 Dec 2008 Posts: 32
|
Posted: Wed Dec 10, 2008 12:04 pm Post subject: |
|
|
im confused this is my proc
#delete the file process
proc del:file {nick user@host handle text} {
set delfile [lindex $text 1].ins
putserv "PRIVMSG $nick :[lindex $text 1] has been removed"
[file delete $delfile]
}
it works like it is but if I place the putserv command beneath the
[file delete $delfile]
the putserv command does not execute. above it, it works fine.
what is it in [file delete $delfile] that stops my process
if I had to execute something after this command how would I?
thanks so much |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Dec 10, 2008 12:30 pm Post subject: |
|
|
1st:
Don't use lindex like that... $text is a string, not a list (consider using split to convert it into a list).
2nd:
Don't enclose the file command with [] if you do not intend to make use of the return code. Currently, you are trying to execute the return code from the file delete operation as a new command.
The file delete command will always return an empty string, causing your script to try and execute "", which is not a valid command. This will generate an error, and script execution is terminated.
Suggested further reading:
Tcl manual page - Command substitutions _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
topdawg_b Voice
Joined: 07 Dec 2008 Posts: 32
|
Posted: Wed Dec 10, 2008 10:59 pm Post subject: |
|
|
| ty for the info I am new to this. it is a lot to consume. info seems to be spread out. I will read. thanks for the help. |
|
| Back to top |
|
 |
|