Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Right justifying prompt data in bash Post 302749027 by fpmurphy on Thursday 27th of December 2012 10:41:49 AM
Old 12-27-2012
Not sure if such a thing is really possible with Bash.

Interestingly, the zsh shell has the ability to display things on the right hand side of a terminal. You can do the same things as with PS1, and you don't have to worry about typing over it, or it messing up your commands. The variable to set is RPS1.
This User Gave Thanks to fpmurphy For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

customize my prompt in bash

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

justifying the fields

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

Works from bash prompt, but not from script!

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

How can i change my bash prompt ?

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

Bash conditional prompt?

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)

Bash prompt wraparound

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

BASH: Getting titlebar and prompt to 'sync up'

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

Bash answer prompt

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

Running an executable from bash prompt

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

Bash prompt is over lapping

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
ZSHROADMAP(1)						      General Commands Manual						     ZSHROADMAP(1)

NAME
zshroadmap - informal introduction to the zsh manual The Zsh Manual, like the shell itself, is large and often complicated. This section of the manual provides some pointers to areas of the shell that are likely to be of particular interest to new users, and indicates where in the rest of the manual the documentation is to be found. WHEN THE SHELL STARTS
When it starts, the shell reads commands from various files. These can be created or edited to customize the shell. See the section Startup/Shutdown Files in zsh(1). If no personal initialization files exist for the current user, a function is run to help you change some of the most common settings. It won't appear if your administrator has disabled the zsh/newuser module. The function is designed to be self-explanatory. You can run it by hand with `autoload -Uz zsh-newuser-install; zsh-newuser-install -f'. See also the section User Configuration Functions in zshcon- trib(1). INTERACTIVE USE
Interaction with the shell uses the builtin Zsh Line Editor, ZLE. This is described in detail in zshzle(1). The first decision a user must make is whether to use the Emacs or Vi editing mode as the keys for editing are substantially different. Emacs editing mode is probably more natural for beginners and can be selected explicitly with the command bindkey -e. A history mechanism for retrieving previously typed lines (most simply with the Up or Down arrow keys) is available; note that, unlike other shells, zsh will not save these lines when the shell exits unless you set appropriate variables, and the number of history lines retained by default is quite small (30 lines). See the description of the shell variables (referred to in the documentation as parameters) HISTFILE, HISTSIZE and SAVEHIST in zshparam(1). Note that it's currently only possible to read and write files saving history when the shell is interactive, i.e. it does not work from scripts. The shell now supports the UTF-8 character set (and also others if supported by the operating system). This is (mostly) handled transpar- ently by the shell, but the degree of support in terminal emulators is variable. There is some discussion of this in the shell FAQ, http://www.zsh.org/FAQ/. Note in particular that for combining characters to be handled the option COMBINING_CHARS needs to be set. Because the shell is now more sensitive to the definition of the character set, note that if you are upgrading from an older version of the shell you should ensure that the appropriate variable, either LANG (to affect all aspects of the shell's operation) or LC_CTYPE (to affect only the handling of character sets) is set to an appropriate value. This is true even if you are using a single-byte character set including extensions of ASCII such as ISO-8859-1 or ISO-8859-15. See the description of LC_CTYPE in zshparam(1). Completion Completion is a feature present in many shells. It allows the user to type only a part (usually the prefix) of a word and have the shell fill in the rest. The completion system in zsh is programmable. For example, the shell can be set to complete email addresses in argu- ments to the mail command from your ~/.abook/addressbook; usernames, hostnames, and even remote paths in arguments to scp, and so on. Any- thing that can be written in or glued together with zsh can be the source of what the line editor offers as possible completions. Zsh has two completion systems, an old, so called compctl completion (named after the builtin command that serves as its complete and only user interface), and a new one, referred to as compsys, organized as library of builtin and user-defined functions. The two systems differ in their interface for specifying the completion behavior. The new system is more customizable and is supplied with completions for many commonly used commands; it is therefore to be preferred. The completion system must be enabled explicitly when the shell starts. For more information see zshcompsys(1). Extending the line editor Apart from completion, the line editor is highly extensible by means of shell functions. Some useful functions are provided with the shell; they provide facilities such as: insert-composed-char composing characters not found on the keyboard match-words-by-style configuring what the line editor considers a word when moving or deleting by word history-beginning-search-backward-end, etc. alternative ways of searching the shell history replace-string, replace-pattern functions for replacing strings or patterns globally in the command line edit-command-line edit the command line with an external editor. See the section `ZLE Functions' in zshcontrib(1) for descriptions of these. OPTIONS
The shell has a large number of options for changing its behaviour. These cover all aspects of the shell; browsing the full documentation is the only good way to become acquainted with the many possibilities. See zshoptions(1). PATTERN MATCHING
The shell has a rich set of patterns which are available for file matching (described in the documentation as `filename generation' and also known for historical reasons as `globbing') and for use when programming. These are described in the section `Filename Generation' in zshexpn(1). Of particular interest are the following patterns that are not commonly supported by other systems of pattern matching: ** for matching over multiple directories ~, ^ the ability to exclude patterns from matching when the EXTENDED_GLOB option is set (...) glob qualifiers, included in parentheses at the end of the pattern, which select files by type (such as directories) or attribute (such as size). GENERAL COMMENTS ON SYNTAX
Although the syntax of zsh is in ways similar to the Korn shell, and therefore more remotely to the original UNIX shell, the Bourne shell, its default behaviour does not entirely correspond to those shells. General shell syntax is introduced in the section `Shell Grammar' in zshmisc(1). One commonly encountered difference is that variables substituted onto the command line are not split into words. See the description of the shell option SH_WORD_SPLIT in the section `Parameter Expansion' in zshexpn(1). In zsh, you can either explicitly request the splitting (e.g. ${=foo}) or use an array when you want a variable to expand to more than one word. See the section `Array Parameters' in zsh- param(1). PROGRAMMING
The most convenient way of adding enhancements to the shell is typically by writing a shell function and arranging for it to be autoloaded. Functions are described in the section `Functions' in zshmisc(1). Users changing from the C shell and its relatives should notice that aliases are less used in zsh as they don't perform argument substitution, only simple text replacement. A few general functions, other than those for the line editor described above, are provided with the shell and are described in zshcon- trib(1). Features include: promptinit a prompt theme system for changing prompts easily, see the section `Prompt Themes' zsh-mime-setup a MIME-handling system which dispatches commands according to the suffix of a file as done by graphical file managers zcalc a calculator zargs a version of xargs that makes the find command redundant zmv a command for renaming files by means of shell patterns. zsh 5.3 December 11, 2016 ZSHROADMAP(1)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy