Hey all, have a question re: parsing command lines. I'm working on an lcshell script (as in a script that mimics a shell like bash) and .. well the simple stuff is simple as you might guess. Its easy enough to set a prompt based on current directory, loop and read stdin for command lines, have it execute commands internal to the script, or execute a shell for external commands as long as they're simple. Currently working on re-creating the functionality of cd command. However, before I proceed too far with this ugly hack it has become apparent that I need better methods of parsing.
I'm hoping to include pipes, redirects, etc. Basically I am hoping to make a fully functional interactive lcshell similar to perlsh. Can anyone suggest reading materials, tutorials, examples of this type of parsing that are basic enough to get me started down a better path than the spaghetti code i'm smooshing together so far? (a mixture of switch blocks, ifs, and 'best guesses') Also, there was a post here about lc and the command line, and being able to execute scripts directly. On linux and mac at least, scripts can use the #! method to locate its executable, so lcserver works great for this. In my case lcserver is located in /usr/lib/cgi-bin/livecode-server so putting the following line first in an lc script will cause it to execute. #!/usr/lib/cgi-bin/livecode-server <?lc your script here ?> The only negative is lc doesn't know to NOT print the # line. (part of the reason i'm working towards an lcshell type script, start it up, then execute what you want.) Don't forget to set the file to executable of course. _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode