tcsh-org / tcsh

This is a read-only mirror of the tcsh code repository.
https://www.tcsh.org/
Other
232 stars 42 forks source link

Updating prompt, after every command, is that possible? #42

Closed DesantBucie closed 2 years ago

DesantBucie commented 2 years ago

Let's say i have a code that sets prompt depending on some variable. Now as I can see running tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-apple-darwin) options wide,nls,dl,bye,al,kan,sm,rh,color,filec the prompt is only read on shell startup and then if variable changes it won't be updated. Is it possible to make that update when variable changes?

example logic


set var=2
if var =~ 2
    set prompt = "blabla"
else
   set prompt ="lalala"
zoulasc commented 2 years ago

Perhaps you can use a postcmd alias that sets the prompt? or quote the variable in the prompt so that it is not immediately expanded.

christos

On Sep 5, 2021, at 12:51 PM, Jakub @.***> wrote:

Let's say i have a code that sets prompt depending on some variable. Now as I can see running tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-apple-darwin) options wide,nls,dl,bye,al,kan,sm,rh,color,filec the prompt is only read on shell startup and then if variable changes it won't be updated. Is it possible to make that update when variable changes?

example logic

set var=2 if var =~ 2 set prompt = "blabla" else set prompt ="lalala" — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tcsh-org/tcsh/issues/42, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENP5N5IXVA4UGCFZ7BOVTUAONXNANCNFSM5DO7NPTQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

[ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/tcsh-org/tcsh/issues/42", "url": "https://github.com/tcsh-org/tcsh/issues/42", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

DesantBucie commented 2 years ago

I will try that, thanks.