revCopyFile problems on Mac OS X.6.4
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
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 :
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 )
function q t
return quote & t & quote
##### Another way which I prefer :
get format( "cp ' %s ' ' %s ' ", tInfile, tOutDir )
put shell( it )
##### A variation of it, which is how I code :
get shell( format( "cp '%s' '%s'", \
$HOME & "/Desktop/test.txt" , \
$HOME & "/Desktop/outDir" ) )
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.
More information about the Use-livecode