Re: [U2] Shell Dispatch Quoting
Thanks Charles, I jumped to using Your U routine and came up with two enhancements. 1) Print a warning when the command supplied uses all three of \,' and " . Can anyone dream up a way of handling it instead ? 2) Add some hardcoded command aliases ( It's sooo irritating to shell out from uv to find that your unix aliases don't work ! ) and in the spirit of open source the enhanced program is here: CMD = TRIMF( @SENTENCE )[' ',2,999] IF CMD = OCONV( CMD,'MCU') THEN CMD = OCONV( CMD,'MCL' ) UC = CMD[' ',1,1] ** Some aliases, change and/or add Your own: BEGIN CASE CASE UC = 'll'; CMD = '/usr/ucb/ls -ls ':CMD[' ',2,999] CASE UC = 'ps'; CMD = '/usr/ucb/':CMD END CASE IF INDEX(CMD,'"',1) THEN IF INDEX(CMD,"'",1) THEN IF INDEX(CMD,'\',1) THEN CRT "Sorry, but you've used all quotes!" END ELSE CMD = '\':CMD:'\' END END ELSE CMD = SQUOTE(CMD) END END ELSE CMD = DQUOTE(CMD) END EXECUTE "sh -c ":CMD STOP END - (( For the curious: /usr/ucb is where the Berkely command versions are kept on solaris )) -- mats << Intentional overquoting to faciliate comparisons. >> Stevenson, Charles wrote: For working at TCL, typing SH -c and proper quote marks, too, is just way too hard for me. So I have a little utility verb, "U", that just takes everything after the first word, and dispatches it. Furthermore, if the entire line is Uppercase (the usual for TCL), then it figures you probably meant Lowercase (the usual for Unix), so it flips it before handing it to sh. U PWD; LS -L U ls -l \&SAVEDLISTS\& | grep "Nov 9" get executed as SH -c"pwd; ls -l" SH -c'u ls -l \&SAVEDLISTS\& | grep "Nov 9"' respectively. If you insist on using all 3 (',", and \), you're on your own. --- PROGRAM U * Author: Charles Stevenson * Date : Jan. 1999 * Type : General Utility verb * Desc. : Shells to unix & executes what's on the command line. * If entire command line is uppercase, converts everything to * lowercase, first. CMD = TRIMF( @SENTENCE )[' ',2,999] IF CMD = OCONV( CMD, 'MCU' ) THEN CMD = OCONV( CMD, 'MCL' ) IF INDEX( CMD, '"', 1 ) THEN IF INDEX( CMD, "'", 1 ) THEN CMD = '\':CMD:'\' END ELSE CMD = SQUOTE( CMD ) END END ELSE CMD = DQUOTE( CMD ) END EXECUTE 'SH -c':CMD STOP --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Shell Dispatch Quoting
Thanks for sharing the U program. Such a simple thing, so many ways to use it! --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Shell Dispatch Quoting
mpack is a neat little utility that will encode an attachement, add a subject line and then mail the whole lot off to your smtp server. With some help from the others on this thread, I've been able to rip out 80+ lines of code and replace it all with a dozen or so lines. And, it works with exchange 2003 which our previous solution did not. If you do a search for "mpack" on google, you'll get a few hits from sites with better descriptions of what it does. One of the great strengths of the UniVerse/UniData/Unix combination is all the freebie tools out there which perform just the right odd job you happen to need done at the moment. Thanks again for the help. Reading over the answers I'm struck by how dingy my question was... :-) --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Shell Dispatch Quoting
What is mpack? - Original Message - From: "Don Kibbey" <[EMAIL PROTECTED]> To: Sent: Wednesday, November 09, 2005 11:15 AM Subject: [U2] Shell Dispatch Quoting I'm attempting to make use of a program called "mpack" which requires some command line arguments to be quoted. While doing this, I'm getting some over quoting and things are not worked as they should. Is there another character or technique (aside from writing the command out as a script and executing it that way) which can be used to get around this? Here's and example of the command I would like to use. mpack -s "this is the subject" -d body.file attachement.pdf emailname To execute this I have to wrap it in quotes like this. SH -c "mpack -s "this is the subject" -d body.file attachement.pdf emailname" This of course makes a mess... Any ideas? Or am I just being goofy today? --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Shell Dispatch Quoting
For working at TCL, typing SH -c and proper quote marks, too, is just way too hard for me. So I have a little utility verb, "U", that just takes everything after the first word, and dispatches it. Furthermore, if the entire line is Uppercase (the usual for TCL), then it figures you probably meant Lowercase (the usual for Unix), so it flips it before handing it to sh. U PWD; LS -L U ls -l \&SAVEDLISTS\& | grep "Nov 9" get executed as SH -c"pwd; ls -l" SH -c'u ls -l \&SAVEDLISTS\& | grep "Nov 9"' respectively. If you insist on using all 3 (',", and \), you're on your own. --- PROGRAM U * Author: Charles Stevenson * Date : Jan. 1999 * Type : General Utility verb * Desc. : Shells to unix & executes what's on the command line. * If entire command line is uppercase, converts everything to * lowercase, first. CMD = TRIMF( @SENTENCE )[' ',2,999] IF CMD = OCONV( CMD, 'MCU' ) THEN CMD = OCONV( CMD, 'MCL' ) IF INDEX( CMD, '"', 1 ) THEN IF INDEX( CMD, "'", 1 ) THEN CMD = '\':CMD:'\' END ELSE CMD = SQUOTE( CMD ) END END ELSE CMD = DQUOTE( CMD ) END EXECUTE 'SH -c':CMD STOP --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Shell Dispatch Quoting
Don, Try this: SH -c 'mpack -s "this is the subject" -d body.file attachement.pdf emailname' HTH Jeff Fitzgerald Fitzgerald & Long, Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Don Kibbey Sent: Wednesday, November 09, 2005 10:58 AM To: u2-users@listserver.u2ug.org Subject: [U2] Shell Dispatch Quoting I'm attempting to make use of a program called "mpack" which requires some command line arguments to be quoted. While doing this, I'm getting some over quoting and things are not worked as they should. Is there another character or technique (aside from writing the command out as a script and executing it that way) which can be used to get around this? Here's and example of the command I would like to use. mpack -s "this is the subject" -d body.file attachement.pdf emailname To execute this I have to wrap it in quotes like this. SH -c "mpack -s "this is the subject" -d body.file attachement.pdf emailname" This of course makes a mess... Any ideas? Or am I just being goofy today? --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Shell Dispatch Quoting
You should be able to say SH -c ' mpack -s "this is the subject" -d body.file attachement.pdf emailname' Thanks, Nick Cipollina -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Don Kibbey Sent: Wednesday, November 09, 2005 12:16 PM To: u2-users@listserver.u2ug.org Subject: [U2] Shell Dispatch Quoting I'm attempting to make use of a program called "mpack" which requires some command line arguments to be quoted. While doing this, I'm getting some over quoting and things are not worked as they should. Is there another character or technique (aside from writing the command out as a script and executing it that way) which can be used to get around this? Here's and example of the command I would like to use. mpack -s "this is the subject" -d body.file attachement.pdf emailname To execute this I have to wrap it in quotes like this. SH -c "mpack -s "this is the subject" -d body.file attachement.pdf emailname" This of course makes a mess... Any ideas? Or am I just being goofy today? --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Shell Dispatch Quoting
Thanks to all! I've now been able to switch over from raw sendmail to mpack. Our new Exchange setup was having some heartburn with the raw sendmail output. Odd that our older Groupwise gateway didn't seem to mind at all. Thanks, --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Shell Dispatch Quoting
Try SH -c 'mpack -s "this is the subject" -d body.file attachement.pdf emailname' (changed outer " to ') Don Kibbey wrote: >I'm attempting to make use of a program called "mpack" which requires >some command line arguments to be quoted. While doing this, I'm >getting some over quoting and things are not worked as they should. >Is there another character or technique (aside from writing the >command out as a script and executing it that way) which can be used >to get around this? > >Here's and example of the command I would like to use. > >mpack -s "this is the subject" -d body.file attachement.pdf emailname > >To execute this I have to wrap it in quotes like this. > >SH -c "mpack -s "this is the subject" -d body.file attachement.pdf emailname" > >This of course makes a mess... > >Any ideas? Or am I just being goofy today? >--- >u2-users mailing list >u2-users@listserver.u2ug.org >To unsubscribe please visit http://listserver.u2ug.org/ [demime 1.01d removed an attachment of type text/x-vcard which had a name of john.vcf] --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Shell Dispatch Quoting
Don, Try using single quotes or backslashes around your command: SH -c \mpack -s "this is the subject" -d body.file attachement.pdf emailname\ Works on UniVerse, not sure about UD... --Ron P. -Original Message- From: Don Kibbey Sent: Wednesday, November 09, 2005 11:16 AM To: u2-users@listserver.u2ug.org Subject: [U2] Shell Dispatch Quoting I'm attempting to make use of a program called "mpack" which requires some command line arguments to be quoted. While doing this, I'm getting some over quoting and things are not worked as they should. Is there another character or technique (aside from writing the command out as a script and executing it that way) which can be used to get around this? --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Shell Dispatch Quoting
> I'm attempting to make use of a program called "mpack" which requires > some command line arguments to be quoted. While doing this, I'm > getting some over quoting and things are not worked as they should. > Is there another character or technique (aside from writing the > command out as a script and executing it that way) which can be used > to get around this? > > Here's and example of the command I would like to use. > > mpack -s "this is the subject" -d body.file attachement.pdf emailname > > To execute this I have to wrap it in quotes like this. > > SH -c "mpack -s "this is the subject" -d body.file attachement.pdf > emailname" Do it this way: sh -c \mpack -s "this is the subject" -d body.file attachment.pdf\ or use ' instead of \ *SQ vs BSL* HTH Karl > > This of course makes a mess... > > Any ideas? Or am I just being goofy today? > --- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ > -- karl _/ _/ _/ _/_/_/ __o _/ _/ _/ _/_/ _-\<._ _/_/_/ _/_/_/ (_)/ (_) _/ _/ _/ _/ .. _/ _/ arl _/_/_/ _/ earson[EMAIL PROTECTED] -- IT Director, ATS Industrial Supply, Inc. http://www.atsindustrial.com Toll-free: 800-789-9300 x29 Direct2Desk: 801-978-4429 Facsimile: 801-972-3888 -- --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
[U2] Shell Dispatch Quoting
I'm attempting to make use of a program called "mpack" which requires some command line arguments to be quoted. While doing this, I'm getting some over quoting and things are not worked as they should. Is there another character or technique (aside from writing the command out as a script and executing it that way) which can be used to get around this? Here's and example of the command I would like to use. mpack -s "this is the subject" -d body.file attachement.pdf emailname To execute this I have to wrap it in quotes like this. SH -c "mpack -s "this is the subject" -d body.file attachement.pdf emailname" This of course makes a mess... Any ideas? Or am I just being goofy today? --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/