Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!hsdndev!wuarchive!cs.utexas.edu!uunet!sco!md From: md@sco.COM (Michael Davidson) Newsgroups: comp.unix.programmer Subject: Re: Getting the original command-line Message-ID: <9306@scolex.sco.COM> Date: 20 Dec 90 07:17:19 GMT References: <1699@travis.csd.harris.com> Sender: news@sco.COM Organization: The Santa Cruz Operation, Inc. Lines: 25 In article <1699@travis.csd.harris.com> brad@SSD.CSD.HARRIS.COM (Brad Appleton) writes: >Is there a way in Unix (BSD and/or AT&T) to retrieve the original command-line >in a C program? [ ... ] >BTW - I really do NOT want argv in this particular case. I want the orignal >command-line, hopefully before quotes and slashes are evaluated but after >filenames, aliases, and variables have been expanded. Sorry, the short answer to your question is "No". The contents of argv[] *are* the original arguments to the program when it was exec()-ed (unless the program itself has subsequently changed them, of course). There is no way that you can get at the original characters that were typed at the shell command prompt to cause the program to be run (if indeed it was run from the shell at all ...) I am also really puzzled by your statement that you want the original command line "before quotes and slashes are evaluated but after filenames, aliases and variables have been expanded" - since in all the shells that I am familiar with backslash and quote characters play a vital role in determining just exactly how the command line is interpreted and what filename expansion etc takes place .... It might help if you explained exactly what you think that you are trying to achieve.