12-27-2012
Right justifying prompt data in bash
Hi,
I have a custom prompt in Bash. However, I would like to further customise it so that it shows me the date and time. However, I would like this new addition to appear on the right side of the terminal window.
The idea behind this is to "visually balance" some data on the right as most of the time the terminal is used from the left.
I hope this make sense. Please let me know if you require further information.
Regards,
vnayak
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
in csh I was using:
set prompt=""$HOSTNAME".tk.\!> "
to customize the look of my prompt. I have seen the light after reading the perils of csh scripting and wish to switch to bash. How do I customize my bash prompt??? I've tried many variation of the above w/no success, and searching this... (2 Replies)
Discussion started by: yankee428
2 Replies
2. Shell Programming and Scripting
hi experts,
i just need a help that my script is generating the output which i will mentioned below but the fileds are not justified the alignment is disturbed.
0 8718 8718 0 8777
1 7450 7450 0 7483
2 5063 5063 0 5091
3 3840 3840 0 3855
4 ... (2 Replies)
Discussion started by: shary
2 Replies
3. Shell Programming and Scripting
I'm trying to use unison from bash on windows with cygwin. I don't know if this is a cygwin question, bash question or unison question. Since I always get reprimanded by the cygwin mailing list for assuming it is a cygwin problem, I'll assume it is a bash question.
The following commands work... (7 Replies)
Discussion started by: siegfried
7 Replies
4. Shell Programming and Scripting
It looks like,
user@hostname:/auto/home3/user$
Desired,
user@hostname$
I added following line in .bashrc, but still its same.
export PS1=" $ "
Please help me :confused: (13 Replies)
Discussion started by: admax
13 Replies
5. UNIX for Advanced & Expert Users
Hi,
Does anyone know any way of making bash prompt extended with conditional content?
Example:
export PS1="] && echo '#' || echo '\$'" # This won't work - prompt is not executed
# export PS1="\$" # This is an existing but also working equivalent
I would like to use more complex... (8 Replies)
Discussion started by: adderek
8 Replies
6. OS X (Apple)
I'm using a custom prompt with PS1 in my .profile. It is
PS1="\\u@\e\:\W\ \\$\ \"
and it works well, as you can see,
http://content.screencast.com/users/killer54291/folders/Jing/media/2b3db52a-ebf7-43e2-95cc-f45dadbc2b98/00000023.png
but, when i type more than the width of the window, it... (0 Replies)
Discussion started by: killer54291
0 Replies
7. Shell Programming and Scripting
This is an instance of "if it's not one thing, it's another."
I recently fell victim to my own stupidity in trashing, by accident, my long-running and very highly-customized .bash_profile and .bashrc files for Cygwin & Cygwin/X. I had backups from a previous "go" with this, and decided to use... (0 Replies)
Discussion started by: SilversleevesX
0 Replies
8. Emergency UNIX and Linux Support
I am working with a script to simplyfy some operations where I work, but one of the programs needs me to enter a password.
It will as me "Please enter the administrator password:"
Is there a way to make a bash script to automatically answer the question with the needed password?
I am looking... (3 Replies)
Discussion started by: noratx
3 Replies
9. Shell Programming and Scripting
Hi,
I'm trying to run a program from the bash prompt and I don't understand why it is returning with an error.
Dig is my C program, and it takes in parameters J4, detect, 3 and 0182F98E
var1="cygdrive/c/2i/test fixture/software/mccdaqtest/debug/Dig J4 detect 3 0182F98E"
when I do
... (6 Replies)
Discussion started by: oahmad
6 Replies
10. UNIX for Dummies Questions & Answers
Hello Guys,
I have facing problem with linux shell prompt .Am expecting my Bash prompt to be like below
but its showing like
~]$ ot@Servername and while typing the commands the prompt looks like below:
~]$ echo $PS1
$
~]$ ot@ServernameChecked the .bash_profile and also changed... (9 Replies)
Discussion started by: kapil514
9 Replies
LEARN ABOUT PLAN9
newuser
NEWUSER(8) System Manager's Manual NEWUSER(8)
NAME
newuser - adding a new user
SYNOPSIS
rc /sys/lib/newuser
DESCRIPTION
To establish a new user on Plan 9, add the user's name to /adm/users by running the newuser command on the console of the file server (see
users(6) and fs(8)). Next, give the user a password using the changeuser command on the console of the authentication server (see
auth(8)). At this point, the user can bootstrap a terminal using the new name and password. The terminal will only get as far as running
rc, however, as no profile exists for the user.
The rc(1) script /sys/lib/newuser sets up a sensible environment for a new user of Plan 9. Once the terminal is running rc, type
rc /sys/lib/newuser
to build the necessary directories in /usr/$user and create a reasonable initial profile in /usr/$user/lib/profile. The script then runs
the profile which, as its last step, brings up 81/2(1). At this point the user's environment is established and running. (There is no
need to reboot.) It may be prudent at this point to run passwd(1) to change the password, depending on how the initial password was cho-
sen.
The profile built by /sys/lib/newuser looks like this:
bind -a $home/bin/rc /bin
bind -a $home/bin/$cputype /bin
font = /lib/font/bit/pelm/euro.9.font
switch($service){
case terminal
prompt=('term% ' ' ')
fn term%{ $* }
exec 81/2
case cpu
bind -b /mnt/term/mnt/81/2 /dev
prompt=('cpu% ' ' ')
echo -n $sysname > /dev/label
fn cpu%{ $* }
news
case con
prompt=('cpu% ' ' ')
news
}
Sites may make changes to /sys/lib/newuser that reflect the properties of the local environment.
Use the -c option of mail(1) to create a mailbox.
SEE ALSO
passwd(1), 81/2(1), namespace(4), users(6), auth(8), fs(8)
NEWUSER(8)