We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

TAB doesn't show available commands

dreamer81
dreamer81 asked
on
Medium Priority
289 Views
Last Modified: 2013-12-06
When I log into this HP UNIX machine with the root account, everything works fine, but then i switch user to my own user account it doesn't work.

When I am root, the promt looks like this
[root@testserver] /systems >

When i use my own account, the promt looks like this
$

Anyone know how to fix this? so i can TAB my way through commands on my own account??
Comment
Watch Question

CERTIFIED EXPERT
Commented:
your defaul login shell is sh, if you want to change your default login shell, modify /etc/passwd file, or run "sam" to change the login shell.

How the promt looks like, it depends on the setting of PS1 in your login script.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
From the shell prompt it looks like the root has the default shell as 'bash'. If you want to make bash your default shell, use the method that yuzh suggests.

If you want to make changes to the /etc/passwd file, you should know the path of the bash shell command. You can do a 'which bash' or 'whereis bash' to get the path of bash. It will mostly be /usr/bin/bash or /usr/local/bin/bash.

To change the prompt, refer http://networking.ringofsaturn.com/Unix/Bash-prompts.php
For e.g. The "[root@testserver] /systems >" prompt can be created by doing the following
PS1="[\u@\h] \w>"
Top Expert 2015

Commented:
only bash completes commands and filenames

use chsh to chenge your shell
/etc/shells hints you with valid shells.

Hi dreamer81,

I am going to give an answer to your questions and some explanation to you:

1. To use TAB, you are going to need the shell called "bash", it usually comes with Linux and not with HP-UX, so if you don't have it in your HP-UX, you can download it from http://hpux.connect.org.uk/hppd/hpux/Shells/bash-3.00.16/.
If you don't have how to "install" bash, there is a command you can use, it is similar to TAB, but it will be used for files in the current directory and commands you have already executed.
In the shell, type "set -o vi" and your shell will be similar to bash: you can start to write a filename that is in the current directory, press: "ESC + ESC", and it will finish to write the filename, also you can use it to check the commands you have already executed: press -> "Ctrl + k" -> Backward - "Ctrl + j" -> Forward. Be careful, k and j are lowercase.

2. About the prompt you want to change, you have to change and export the environment variable called: PS1
Try: echo ${PS1}

You can do a lot of things with this variable, I am going to show you some of them:
export PS1="[`/usr/bin/whoami`@`/usr/bin/uname -n`]:\$PWD# "

In the above, you will have something similar to:
[<Current User>@<Hostname>]:<Current Path>#

The good thing above is the <Current Path>, because it will always show the current directory with path to it.
===========================================================================
[utest@Test]:/opt/java1.4# pwd
/opt/java1.4
[utest@Test]:/opt/java1.4# cd ..
[utest@Test]:/opt# pwd
/opt
[utest@Test]:/opt#
===========================================================================

You can put the export in your profile:
===========================================================================
cd $HOME
vi .profile
===========================================================================

Just for further information, if you check in all unix environments, you will always have 4 PS variables: PS1, PS2, PS3, PS4
===========================================================================
[utest@Test]:/opt# set | grep PS
PS1=[utest@Test]:$PWD#
PS2=>
PS3=#?
PS4=+
===========================================================================
If you want to know what they are used for, check the link: http://www.livefirelabs.com/unix_tip_trick_shell_script/apr_2003/04282003.htm

I hope it helps. =0)
Ops... I made a mistake above: when I say "press -> "Ctrl + k" -> Backward - "Ctrl + j" -> Forward", change the "Ctrl" to "ESC".

How I could do that? hahah

=0)
root_start, did you miss to tell us that your "set -o vi" is for ksh?

>  only bash completes commands and filenames
wrong
tcsh can do it also
csh completes directories and filenames too, but not commands
Top Expert 2015

Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:

split between yuzh http:#16368394 and root_start http:#16651153

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

gheist
EE Cleanup Volunteer
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.