I than mixed the codes I found on these sites together to make something below:
I am by no means an expert Bash scripter however, once I started looking at the code I was able to roughly figure out how this worked. Obviously this code be improved upon but this serves my purpose for now.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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 DEBIAN
aepromptcmd
aepromptcmd(1)aepromptcmd(1)NAME
aepromptcmd - change prompt color by change state
SYNOPSIS
PROMPT_COMMAND="aepromptcmd"
DESCRIPTION
The bash(1) shell has an interesting property: If the PROMPT_COMMAND vaiable is set, the value is executed as a command prior to issuing
each primary prompt. (Actually, it can be a seties of semicolon separated commands.)
In order to change the text back to normal, the PS1 variable needs to have "33[0m" somewhere near the end, otherwise things can get a
little difficult to read. If you are using bash(1), you need to let it know these are unprintable (like this: "[33[0m]") or it messes
up command line editing.
The aepromptcmd command is used to set the color of the prompt, based on the state of the current change. This is an idea taken from Kent
Beck's Test Driven Development book. If the change is in the being developed or being integrated state and it needs to be built, the
prompt is red; if it is built but it needs to be tested, the prompt is magenta, otherwise it is green.
Example
Here is a short script you can put in your .bashrc file to turn on prompt coloring:
if [ "$PS1" ] then
case "$PROMPT_COMMAND" in
"" ) PROMPT_COMMAND="aepromptcmd" PS1="$PS1^[[0m" ;;
*aepromptcmd*) ;;
*) PROMPT_COMMAND="$PROMPT_COMMAND;aepromptcmd" PS1="$PS1[33[0m]" ;;
esac
export PROMPT_COMMAND
export PS1 fi
Note that this usually leaves your prompt default (black) when you are not somewhere inside a development directory.
Limitations
The aepromptcmd command uses the ANSI color escape sequences. It really should to use the tigetstr(3) function from terminfo(3) to do
this in a terminal independent way. Code contributions welcome.
OPTIONS
The following options are understood:
-Change number
This option may be used to specify a particular change within a project. See aegis(1) for a complete description of this option.
-Project name
This option may be used to select the project of interest. When no -Project option is specified, the AEGIS_PROJECT environment
variable is consulted. If that does not exist, the user's $HOME/.aegisrc file is examined for a default project field (see aeu-
conf(5) for more information). If that does not exist, when the user is only working on changes within a single project, the
project name defaults to that project. Otherwise, it is an error.
-Help
This option may be used to obtain more information about how to use the aepromptcmd program.
-Verbose
By default error messages are supressed, so that the prompt will be normal when you are outside an Aegis work area. Use this
option to tuen error messages back on.
See also aegis(1) for options common to all aegis commands.
All options may be abbreviated; the abbreviation is documented as the upper case letters, all lower case letters and underscores (_) are
optional. You must use consecutive sequences of optional letters.
All options are case insensitive, you may type them in upper case or lower case or a combination of both, case is not important.
For example: the arguments "-project, "-PROJ" and "-p" are all interpreted to mean the -Project option. The argument "-prj" will not be
understood, because consecutive optional characters were not supplied.
Options and other command line arguments may be mixed arbitrarily on the command line, after the function selectors.
The GNU long option names are understood. Since all option names for aepromptcmd are long, this means ignoring the extra leading '-'.
The "--option=value" convention is also understood.
EXIT STATUS
The aepromptcmd command will exit with a status of 1 on any error. The aepromptcmd command will only exit with a status of 0 if there are
no errors.
ENVIRONMENT VARIABLES
See aegis(1) for a list of environment variables which may affect this command. See aepconf(5) for the project configuration file's
project_specific field for how to set environment variables for all commands executed by Aegis.
COPYRIGHT
aepromptcmd version 4.24.3.D001
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Peter
Miller
The aepromptcmd program comes with ABSOLUTELY NO WARRANTY; for details use the 'aepromptcmd -VERSion License' command. This is free soft-
ware and you are welcome to redistribute it under certain conditions; for details use the 'aepromptcmd -VERSion License' command.
AUTHOR
Peter Miller E-Mail: millerp@canb.auug.org.au
//* WWW: http://www.canb.auug.org.au/~millerp/
Reference Manual Aegis aepromptcmd(1)