Account Customisation (zsh): Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
Line 128: Line 128:
So say I'm the only person in your .friends file whose username begins with "c". Typing "ps -fU c<-TAB->" will auto-complete to "ps -fU receive" (NB* this will also work for an alias of that command if you have one set). This can be convenient if you have a list of commands that you use on a regular basis for which aliases would be unsuitable.
So say I'm the only person in your .friends file whose username begins with "c". Typing "ps -fU c<-TAB->" will auto-complete to "ps -fU receive" (NB* this will also work for an alias of that command if you have one set). This can be convenient if you have a list of commands that you use on a regular basis for which aliases would be unsuitable.
zsh message (exporting ARGV0)
zsh message (exporting ARGV0)
== Customised zsh messages ==
You may have seen when you "spy" on another user's processes that they have a customised zsh message in the process list. More and more people do this as an added customisation (and annoyance ;)) to their account.
receive@murphy (~) % ps -fU receive
UID        PID  PPID  C STIME TTY          TIME CMD
receive  2120  2118  0 Feb09 pts/212  00:00:01 -zsh
receive  16581  2120  0 02:00 pts/212  00:00:00 ps -fU receive
receive@murphy (~) % ARGV0='Custom Message' exec zsh
receive@murphy (~) % ps -fU receive
UID        PID  PPID  C STIME TTY          TIME CMD
receive  2120  2118  0 Feb09 pts/212  00:00:02 Custom Message
receive  22095  2120  0 02:06 pts/212  00:00:00 ps -fU receive
The command ARGV0='Custom Message' exec zsh changes the default message from -zsh to whatever you want. If you want this to be set everytime you login to redbrick, you can place the command in a file called .zlogin in your home directory. This file automatically gets sourced, when you exec a login session on the system.
'''Be Careful:'''
If you are going to use a .zlogin file with the ARGV0 variable exported to something else, then you should take any commands from your .zshrc file, which print information to the screen and move them into your .zlogin instead. The reason for this is that when you log in, the system will:
* source your .zshrc
* source your .zlogin containing - ARGV0="" exec zsh
* source your .zshrc again - because of the exec zsh in .zlogin
If there were any commands in your .zshrc that printed to the screen, rbusers for example, then they would end up printing twice. So for any programs which you want to print to the command prompt at login. You should place them in your .zlogin.
Also be aware that resetting ARGV0 from its unset state will annoy some programs, most notably mv and cp, which will complain that the command is not of the right format. To get around this, do unset ARGV0, and then (if you must) reset the ARGV0 to its original value by either running ARGV0='Custom Message' exec zsh or sourcing your .zlogin file.
If you have any problems or mess something up and need help, just talk to [[Helpdesk]].

Navigation menu