Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Set prompt, problems and tricks Post 302137747 by tomas on Wednesday 26th of September 2007 05:20:33 PM
Old 09-26-2007
This is an ugly way to do it.

VAR0=`echo $HOME | cut -f3 -d'/'`
VAR1=`echo $HOME | wc -c`
VAR2=`pwd | cut -c${VAR1}-`
echo ${VAR0}${VAR2}

But it will give you the desired output.

I wouldn't use this example because if you go below your $HOME path it doesn't show anything.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

kill, set prompt

ok, there is a way to nicely kill a suspended job and to terminate another without using the mass -KILL command. also, how can I set my prompt temporarly without using the .bash_profile that uses the PS1. Thanks:) (1 Reply)
Discussion started by: bitwize
1 Replies

2. UNIX for Dummies Questions & Answers

set prompt in sh

hi, this < setprompt 'set prompt="# "' > is set in C shell. what is the equivalent in sh? thanks (14 Replies)
Discussion started by: yls177
14 Replies

3. Shell Programming and Scripting

set timeout for ssh prompt

Hi all, I want to set a timeout say 10 sec to shh prompt i.e. if no password is enetered for 10 sec prompt should again come to shell. How can this be achieved ?? I am using Linux RHEL 5 and Solaris 10. Pls help. Thanks in adv. VIKAS (3 Replies)
Discussion started by: vikas027
3 Replies

4. Shell Programming and Scripting

CWD in prompt only showing the directory when set

Hi Gurus, I am working in tcsh and i set the prompt with this. set prompt = "$cwd>" But I see teh prompt only gets reflected with the directory where I set the prompt. After i cd to another directory it still shows the old directory. Please advise (1 Reply)
Discussion started by: kinny
1 Replies

5. Shell Programming and Scripting

tcsh/csh: set prompt in production to color red

Hi folks This is our prompt at the moment oracle@pinkipinki:/opt/oracle> grep 'set prompt' .cshrc set prompt = "$user@`uname -n`:$cwd> " We wish to have in production the same prompt, but red. Howto do that? I tried a lot a internet manuals, but it doesn't work. (1 Reply)
Discussion started by: slashdotweenie
1 Replies

6. Shell Programming and Scripting

Problems with expect and set variables

I'm writing a script that'll send a time-stamp to my backup server. I create a file with the name of the current date, send it to my server with scp and rm the file from the local computer. Individually these commands work fine and with a set name the expect scripts also work fine. The problem... (0 Replies)
Discussion started by: Ktesh564
0 Replies

7. UNIX for Dummies Questions & Answers

set prompt = pwd

Assume that you want to set your prompt to display the current working directory followed by a percent symbol and then a space. The command pwd can be used to display this information, so explain why the following command does not have the expected result: set prompt=" `pwd`'%' " Its a... (7 Replies)
Discussion started by: Blockshelf
7 Replies

8. HP-UX

Unable to Set Prompt to current working DIR

HPUX does not recognise \h,\w,\u to display the hostname,working directory and username respectively. So how do i set the PS1 variable to display my current working Directory as my prompt? I also tried PS1=$PWD, But it keeps showing the same directory path as prompt which PWD was holding at... (3 Replies)
Discussion started by: Amit Kulkarni
3 Replies

9. UNIX for Dummies Questions & Answers

Any tricks on excluding a set of strings from a file?

Hi, Test file below: $: cat file1 DATE TIME COL1 COL2 COL3 COL4 ID 01/10/2013 0800 100 200 300 401 112 01/31/2013 1000 201 123 345 456 107 03/05/2013 1100 150 789 311 789 109 02/15/2013 1500 199 456 234 ... (3 Replies)
Discussion started by: newbie_01
3 Replies

10. UNIX for Beginners Questions & Answers

Problems with set up Cron

Hi I want to set up a cron for every 15 minutes between some hours. Can you tell whether the below command will work. Getting confuse because my time goes from night to next day morning. i want to setup 8 PM to next day 10 AM. */15 20-10 * * * sh abc.sh (1 Reply)
Discussion started by: raju2016
1 Replies
SU(1)							    BSD General Commands Manual 						     SU(1)

NAME
su -- substitute user identity SYNOPSIS
su [-] [-flm] [login [args]] DESCRIPTION
The su utility requests appropriate user credentials via PAM and switches to that user ID (the default user is the superuser). A shell is then executed. PAM is used to set the policy su(1) will use. In particular, by default only users in the ``admin'' or ``wheel'' groups can switch to UID 0 (``root''). This group requirement may be changed by modifying the ``pam_group'' section of /etc/pam.d/su. See pam_group(8) for details on how to modify this setting. By default, the environment is unmodified with the exception of USER, HOME, and SHELL. HOME and SHELL are set to the target login's default values. USER is set to the target login, unless the target login has a user ID of 0, in which case it is unmodified. The invoked shell is the one belonging to the target login. This is the traditional behavior of su. The options are as follows: -f If the invoked shell is csh(1), this option prevents it from reading the ``.cshrc'' file. -l Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as above. USER is set to the target login. PATH is set to ``/bin:/usr/bin''. TERM is imported from your current environment. The invoked shell is the target login's, and su will change directory to the target login's home directory. - (no letter) The same as -l. -m Leave the environment unmodified. The invoked shell is your login shell, and no directory changes are made. As a security precau- tion, if the target user's shell is a non-standard shell (as defined by getusershell(3)) and the caller's real uid is non-zero, su will fail. The -l (or -) and -m options are mutually exclusive; the last one specified overrides any previous ones. If the optional args are provided on the command line, they are passed to the login shell of the target login. Note that all command line arguments before the target login name are processed by su itself, everything after the target login name gets passed to the login shell. By default (unless the prompt is reset by a startup file) the super-user prompt is set to ``#'' to remind one of its awesome power. ENVIRONMENT
Environment variables used by su: HOME Default home directory of real user ID unless modified as specified above. PATH Default search path of real user ID unless modified as specified above. TERM Provides terminal type which may be retained for the substituted user ID. USER The user ID is always the effective ID (the target user ID) after an su unless the user ID is 0 (root). FILES
/etc/pam.d/su PAM configuration for su. EXAMPLES
su man -c catman Runs the command catman as user man. You will be asked for man's password unless your real UID is 0. su man -c 'catman /usr/share/man /usr/local/man' Same as above, but the target command consists of more than a single word and hence is quoted for use with the -c option being passed to the shell. (Most shells expect the argument to -c to be a single word). su -l foo Simulate a login for user foo. su - foo Same as above. su - Simulate a login for root. SEE ALSO
csh(1), sh(1), group(5), passwd(5), environ(7), pam_group(8) HISTORY
A su command appeared in Version 1 AT&T UNIX. BSD
September 13, 2006 BSD
All times are GMT -4. The time now is 05:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy