revCopyFile problems on Mac OS X.6.4

Thierry th.douez at gmail.com
Mon Sep 6 04:42:52 EDT 2010


Le 6 sept. 2010 à 00:18, biodan a écrit :

> ... shell from a Terminal session does not work

Hi.

Yes it works !

> put $HOME &"/Desktop/test.txt" into tInfile
> put $HOME &"/Desktop/outDir" into tOutDir
> put "cp tInfile tOutDir" into tCmd
> put shell(tCmd)


Just commenting your last line and write :

put tCmd

should have given you enough explanation...

Personally,  I never use this error prone syntax of putting vars inside quoted strings...

##### One way to do it :

put "cp" && q( tInfile) && q( tOutDir) into tCmd
put shell( tCmd )
end mouseUp

function q t
   return quote & t & quote
end q

##### Another way which I prefer :

get format( "cp   ' %s '   ' %s ' ", tInfile, tOutDir )
put shell( it )

##### A variation of it, which is how I code :

on mouseUp
   get shell( format( "cp   '%s' '%s'",      \
          $HOME & "/Desktop/test.txt" , \
          $HOME & "/Desktop/outDir"     ) )
end mouseUp

And I'm sure others can point out different writing style.....
Be happy with yours, but check/test/test and test.... your code.
put and answer commands are good friends for that.

Regards,
Thierry




More information about the use-livecode mailing list