Sponsored Content
Full Discussion: 2 line prompt
Top Forums UNIX for Dummies Questions & Answers 2 line prompt Post 22752 by RTM on Monday 10th of June 2002 12:41:03 PM
Old 06-10-2002
set_prompt() {
case "$1" in
-ksh)
PS1='[$USER@$HOSTNAME]:$PWD
$ '
;;
-sh)
PWD=`pwd`
PS1="[$USER@$HOSTNAME]:$PWD
$ "
;;
esac
}
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Path in prompt line?

Can anyone tell me what makes the current path appear in the prompt ? thx (4 Replies)
Discussion started by: Leitwolf
4 Replies

2. AIX

prompt line

Hlo sir My system file / system file is full and i am unable to enter any command such as ls or to start my server RS6000 The network is blocked and the users are log off. (0 Replies)
Discussion started by: sobnc
0 Replies

3. Shell Programming and Scripting

How to enter if-then condition on command prompt/line ?

Hi I have some trouble entering if-then condition in a single line on a command prompt in csh. Could someone show how does one do that ? eg: source .cshrc; cd $dir; pwd; test -d $backup_dir; if then mkdir -p ${backup_dir}; echo inside loop; fi; echo outside loop; mv -f... (3 Replies)
Discussion started by: mpc8250
3 Replies

4. Shell Programming and Scripting

Print a message at specific line on prompt

Hi Friends, I am using HP-UNIX(ksh). I want to print a message at specific line on the prompt screen. For Example: for num in 1 10 3 145 do echo $num // need to print this on the same line for each number sleep 2 done Actual Output: ========== 1 10 3 145 Expected Output:... (5 Replies)
Discussion started by: Niroj
5 Replies

5. UNIX Desktop Questions & Answers

Website-Command Line Prompt

Hello guys... I am having a doubt. Please try to rectify it. I would really appreciate it. The thing is that is it possible to open any website say for example,google from the command line prompt(terminal) if you are working in Linux-fedora... I am very new to Unix. regards, Mahesh... (2 Replies)
Discussion started by: mraghunandanan
2 Replies

6. Shell Programming and Scripting

Is it possible to prompt for input if not given on command line?

I have a script built that takes the standard inputs $1 $2 $3 after the name and parses some data. hexsite=`echo "obase=16;$1"|bc` hexfix=$(printf "%.3X" 0x$hexsite) if || ;then type=33 elif || ;then type=59 elif ;then type=99 else type=00 fi cat /directory/*.2012$3*| I am... (8 Replies)
Discussion started by: PCGameGuy
8 Replies

7. Shell Programming and Scripting

Two-line prompt using Korn

I'm attempting to set up a two-line prompt using Korn. This is what I've set up in .kshrc PS1='$(print -n "`logname`@`hostname`:";if ] then; print -n "~${PWD#$HOME}"; else; print -n "$PWD";fi;print "\n$ ")' And in .profile, ENV="$HOME/.kshrc"; export ENV The hosts that in use are... (10 Replies)
Discussion started by: capnpepper
10 Replies

8. Solaris

Unable to move from rsc prompt to ok prompt

Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 Replies

9. Shell Programming and Scripting

Expect prompt extending to next line

Hi guys, I am trying to install a software which is a shell script. I am using expect to do the silent installation. There is a strange line during the installation of the software like this below. The prompt goes to the next line. ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE... (0 Replies)
Discussion started by: kapkap
0 Replies

10. Shell Programming and Scripting

How to add charactère before all line return by prompt?

For example, if i do ls I want to have a string like "<br> file1 ....... <br>file2 ..... <br>file3 ....." i think i ve to use xargs, but i can't find the solution. Thanks (3 Replies)
Discussion started by: cterra
3 Replies
Net::CLI::Interact::Role::Prompt(3pm)			User Contributed Perl Documentation		     Net::CLI::Interact::Role::Prompt(3pm)

NAME
Net::CLI::Interact::Role::Prompt - Command-line prompt management VERSION
version 1.121640 DESCRIPTION
This is another core component of Net::CLI::Interact, and its role is to keep track of the current prompt on the connected command line interface. The idea is that most CLI have a prompt where you issue commands, and are returned some output which this module gathers. The prompt is a demarcation between each command and its response data. Note that although we "keep track" of the prompt, Net::CLI::Interact is not a state machine, and the choice of command issued to the connected device bears no relation to the current (or last matched) prompt. INTERFACE
set_prompt( $prompt_name ) This method will be used most commonly by applications to select and set a prompt from the Phrasebook which matches the current context of the connected CLI session. This allows a sequence of commands to be sent which share the same Prompt. The name you pass in is looked up in the loaded Phrasebook and the entry's regular expression stored internally. An exception is thrown if the named Prompt is not known. Typically you would either refer to a Prompt in a Macro, or set the prompt you are expecting once for a sequence of commands in a particular CLI context. When a Macro completes and it has been defined in the Phrasebook with an explicit named Prompt at the end, we can assume the user is indicating some change of context. Therefore the "prompt" is automatically updated on such occasions to have the regular expression from that named Prompt. prompt_re Returns the current Prompt in the form of a regular expression reference. The Prompt is used as a default to catch the end of command response output, when a Macro has not been set up with explicit Prompt matching. Typically you would either refer to a Prompt in a Macro, or set the prompt you are expecting once for a sequence of commands in a particular CLI context. unset_prompt Use this method to empty the current "prompt" setting (see above). The effect is that the module will automatically set the Prompt for itself based on the last line of output received from the connected CLI. Do not use this option unless you know what you are doing. has_set_prompt Returns True if there is currently a Prompt set, otherwise returns False. prompt_looks_like( $name ) Returns True if the current prompt matches the given named prompt. This is useful when you wish to make a more specific check on the current prompt. find_prompt( $wake_up? ) A helper method that consumes output from the connected CLI session until a line matches any one of the named Prompts in the loaded Phrasebook, at which point no more output is consumed. As a consequence the "prompt" will be set (see above). This might be used when you're connecting to a device which maintains CLI state between session disconnects (for example a serial console), and you need to discover the current state. However, "find_prompt" is executed automatically for you if you call a "cmd" or "macro" before any interaction with the CLI. The current device output will be scanned against all known named Prompts. If nothing is found, the default behaviour is then to send the content of our "wake_up" slot (see below), and try to match again. The idea is that by sending one carriage return, we might be sent a new prompt. If you wish to disable this behaviour, pass a false value into this method. wake_up Text sent to a device within the "find_prompt" method if no output has so far matched any known named Prompt. Default is the value of the output record separator from the Transport (one newline). last_prompt Returns the Prompt which most recently was matched and terminated gathering of output from the connected CLI. This is a simple text string. last_prompt_re Returns the text which was most recently matched and terminated gathering of output from the connected CLI, as a quote-escaped regular expression with line start and end anchors. AUTHOR
Oliver Gorwits <oliver@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Oliver Gorwits. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-12 Net::CLI::Interact::Role::Prompt(3pm)
All times are GMT -4. The time now is 01:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy