I have a Squirrel plugin as below:
fe.add_transition_callback( "removefavourite" );
function removefavourite( ttype, var, ttime )
{
switch ( ttype )
{
case Transition.ChangedTag:
print( fe.game_info( Info.Name ) + "\n" );
system( "echo '" + fe.game_info( Info.Name ) + "' > /home/pi/.attract/romlists/ROMNAME.tmp" );
system( "printf '" + fe.game_info( Info.Emulator ) + "' > /home/pi/.attract/romlists/ROMNAME2.tmp" );
break;
}
return false;
}
fe.add_transition_callback( "removefavourite" )
I would like to redirect the output of the "print" command from terminal/console to a file. However, I cannot seem to do so and would be grateful if someone could assist me please.
I've tried alternatives in bash - many variations of the "echo" command and the "printf" command, but these are not effective to capture words which include parentheses eg () or single quotes eg '. The "print" command seems to be effective in all cases but I have not been able to redirect the output.
Please note that I am unable to modify the words I'm capturing first by escaping/backslashing special characters before sending them to print, echo or printf.
Thank you.