![]() |
|
General software and network General OS-independent software and network questions, X11, MTA, routing, etc. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
Hi everyone. Im using laptop with FreeBSD. What Im trying to do is to display the remaining capacity and time in the shell prompt.
It is easily achieved with bash, but in zsh, the command is only executed upon startup. This is a bash prompt in the .bashrc file. I use the date command as an example. The current time will be updated everytime you exec new command: Code:
PS1='`date +'%H:%M:%S'` \!\[\e[1;31m\][\[$?]\[\e[37m\]\u@\h:\w\\$ ' |
|
|||
![]()
Ah, nvm, I found it. It is precmd
![]() |
|
|||
![]()
Under the OpenBSD ksh the following works
Code:
PS1="\$(date +'%H:%M:%S')" 23:24:31 23:24:35 23:24:35sleep 60 23:25:44 23:29:23 23:29:52 Because '\' only works when the shell gets to interpret it, double quotes (") were used instead of single quotes (').
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nicer Prompt with ksh on 5.0 | nihonto | NetBSD Installation and Upgrading | 8 | 12th October 2009 08:49 PM |
backup freeBSD 7.0 using Backup Exec | ccc | FreeBSD General | 2 | 25th April 2009 09:23 PM |
changing custom prompt ksh for root. | bsdnewbie999 | OpenBSD General | 7 | 1st April 2009 04:53 AM |
init: can't exec getty after power failure | mtx | FreeBSD General | 0 | 20th January 2009 10:14 AM |
what to do at mountroot prompt? | Sunsawe | FreeBSD General | 13 | 5th June 2008 08:06 AM |