So when you snarf a line and paste it, if you included the system prompt, that should run the command, as your prompt is a function with arguments of the command and flags,
-- Mat Kovach [email protected] On Sat, Oct 3, 2026, at 22:22, Skip Tavakkolian wrote: > just to be sure, the interesting part of the quiz isn't the prompt but > the function and why it is useful. > > but of course, if you have a dynamic prompt, then the fn example in > the quiz would also need to be created for every prompt which would > pollute /env a fair bit. > > On Sat, Oct 3, 2026 at 7:08 AM Lyndon Nerenberg (VE7TFX/VE6BBM) > <[email protected]> wrote: >> >> Skip Tavakkolian writes: >> > suppose i have these lines in the cpu section of my $home/lib/profile: >> > >> > prompt=3D($sysname^'% ' ' ') >> > fn $sysname^%{ $* } >> > >> > what is the utility of the func on the second line? >> :-) >> >> Here is my version from Unix (I have a Plan9 one as well): >> >> setprompt () { >> PS1=": "$(id -un)@$(hostname|sed 's;\..*$;;'):$(pwd -L|sed -e >> s%${HOME}%~%)'; ' >> } >> cd () { >> command cd "$@" && setprompt >> } >> setprompt >> >> This works with just about every Unix shell, although I stay >> parked in ksh whenever possible. >> >> The 'sed' fragmant can probably be removed and '-s' added to the >> hostname command. It's there from days gone by when one of the >> Unixen I used didn't support -s. And I find including the path is >> immensely helpful. In some cases, I will left-truncate it at >> 32-or-so chars. Not an issue on plan9 as if I get that deep into >> a diretory maze, I just bind it to a shorter name. >> >> --lyndon ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfc2f1095f79c2bb7-M89618ab63a9ff8cfa8d8942f Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
