Path: utzoo!attcan!uunet!software.org!stluka From: stluka@software.org (Fred Stluka) Newsgroups: comp.unix.shell Subject: Re: Built-in String Processing? Message-ID: <1763@software.software.org> Date: 31 Oct 90 02:49:46 GMT References: <1990Oct27.215051.14085@midway.uchicago.edu> <1990Oct29.160325.23250@ux1.cso.uiuc.edu> Sender: news@software.org Reply-To: stluka@software.org (Fred Stluka) Organization: Software Productivity Consortium, Herndon, Virginia Lines: 34 In article <1990Oct29.160325.23250@ux1.cso.uiuc.edu> hirchert@harriett.ncsa.uiuc.edu (Kurt Hirchert) writes: > > # aliases for changing the prompt to include current directory > alias setprompt 'set prompt="("`pwd |'\ > 'sed -e "s|^$home|~|"'\ > '`") "'\""`hostname` \\!% "\" > alias cd "cd \!* ; setprompt" > alias chdir "chdir \!* ; setprompt" > alias pushd "pushd \!* ; setprompt" > alias popd "popd \!* ; setprompt" Here's a trick I stumbled across while setting up my own version of this a while back. Try typing: dirs If the directories that it reports are always in the form you want (on my Apollo, ~ is displayed instead of the long pathname to my home directory), you can eliminate sed from the pipeline in setprompt by using dirs instead of pwd as the starting point. Example: alias setprompt \ 'set noglob;set d=(`dirs`);set prompt="$d[1] % ";unset noglob' --Fred Fred Stluka Internet: stluka@software.org Software Productivity Consortium UUNET: ...!uunet!software!stluka 2214 Rock Hill Rd, Herndon VA 22070