M014JL4L@VB.CC.CMU.EDU (01/29/88)
Greetings VAXers! This is my first posting to Info-VAX (I guess I'm no longer "just a reader"). This is in response to "getting current dir in dcl prompt" from The Radio Gnome who writes: > The logical thing to do would be: > > $TEMP = "show default" > $SET PROMPT = 'TEMP' > > ..but VMS will only take a string for SET PROMPTs argument > and the string must not have spaces in it. VMS complains about > "too many parameters" >:-{ > > > There was/is a similar discussion going on in unix-wizards > where: > > set prompt 'pwd' (I think?) seemed to do the trick. > > Has anyone else come up with a solution? Well, I have a solution. It may not be completely clean or elegant, but is seems to work and I hope it helps. To use, simply copy to a file called SETDEF.COM and follow the instructions. John K. Lerchey MEMS CMU =================================cut here==================================== $! $! SETDEF.COM: changes the users current directory (set default) and changes $! the users prompt to show the current default directory $! $! written 01-27-88 by John K. Lerchey $! $! $!Copy and use freely. This command proceedure does almost no error $! checking or verification. $! $! $! John K. Lerchey $! $! Define a symbol in your login.com file as follows: $! $ SETDEF :== @$disk?[whatever.subdirectory]SETDEF.COM $! $! Afterwards, $ SETDEF [wherever] should work provided that you have not told $! it to take you to a non-existant directory. $! $!=========================================================================== $! NOTE: I did run into one error while writing this code. I had preceded the $! directory name for the prompt with the node name of the machine I was on. $! though the command procedure set the defautl correctly, it gave and error $! when it tried to set prompt due to the string being too long. Be carefule $! if you have excessively long directory names! $!=========================================================================== $! $! change default directory $ get_directory: $ if p1 .eqs. "" then inquire /nopunctuation p1 "_to Directory: " $ if p1 .eqs. "" then goto get_directory $ set default 'p1' $! $! get directory name $ Directory_Name = f$directory () $ set prompt = "''Directory_Name': " $exit =================================cut here==================================== -------