- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell queries
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2003 10:50 PM
08-10-2003 10:50 PM
The default shell for root is /sbin/sh and not /usr/bin/sh. Why? (maybe for sigle user mode?) Does it still have all POSIX functionality.
I read that vi is on by default for POSIX (/usr/bin/sh), but I have to turn it on manually set -o vi.
Why doesn't my env variable $SHELL's value change when I change my shell?
As for recalling history, is it that the POSIX shell requires the HISTFILE variable to be defined whereas the Korn shell (/usr/bin/ksh) does not.
From where does the vi read history command if I have removed the .sh_history file?
Simple questions, but put together they're somewhat confusing
Regards,
-Alvi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2003 11:02 PM
08-10-2003 11:02 PM
Re: shell queries
If the shell lived in root, then you would not be able to boot single user or maintenance level.
The posix shell does require the HISTFILE environment variable to be defined.
Hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2003 11:07 PM
08-10-2003 11:07 PM
Re: shell queries
1 Yes it is for single user mode / maintenance mode /usr is not mounted in single user mode, therefore your system will not boot if you use /usr/bin/sh as a shell for root.
2 .profile variable for SHELL /sbin/sh
EDITOR=vi
export EDITOR
3 .profile variables
HISTFILE=/root/.sh_history
PS1="$(hostname):\$PWD\# "
HISTSIZE=250
export HISTFILE PS1 HISTSIZE
4 .sh_history will be recreated at next login.
Hope it helps,
Robert-Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2003 11:25 PM
08-10-2003 11:25 PM
Solutionin addition to previous execllent respinse, i add this:
export HISTFILE=$HOME/.sh_history`tty|tr / _`
With this setting of history file, expecially usefull for root, each separate root connection will have his own history file, with many important consequences:
- every other root can check what the other is doing separately,
- you get no "rm -r *" by accident, recalling hte command of someone else
- when you login interactively, with "who -HRT" you can check what the others are doing
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2003 11:55 PM
08-10-2003 11:55 PM
Re: shell queries
The SHELL variable only shows the login shell, i.e. the original shell, therefore it does not change.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2003 12:42 AM
08-11-2003 12:42 AM
Re: shell queries
I don't know why, but on one of my systems I'm not able to set history for the default /sbin/sh shell. I have the variables defined, and DTSOURCEPROFILE=true uncommented, but no success. HISTFILE defined and created.
Another thing ... Is there no HOSTNAME built in shell variable?
And does the Korn shell not require the HISTFILE variable defined, or the history file itself. I noted history working in ksh despite deleting the .sh_history.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2003 01:22 AM
08-11-2003 01:22 AM
Re: shell queries
Can you try to telnet to the server anc check? Maybe is related to DCE and not to the settings
>Another thing ... Is there no HOSTNAME built in >shell variable?
No,
but you can define your own in .profile
HOSTNAME=$(hostname)
>And does the Korn shell not require the >HISTFILE variable defined, or the history file >itself. I noted history working in ksh despite >deleting the .sh_history.
If you were using ksh and after deleted the .sh_history, at next logon history won't work.
AFAIK it uses the file, bua file can be deleted even if it is open by another process (thanks unix!).
Test this:
vi pippo.txt
edit it, leaving it open
from another shell, delete pippo.txt.
You will be able to edit it the same :)
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2003 02:19 AM
08-11-2003 02:19 AM
Re: shell queries
In the .profile I was using an undefined variable causing an error. Nothing following that line was executed.
Once I corrected the error History works fine. Is this also default behaviour, shouldn't the shell continue parsing .profile despite the error?
... and thanks again Massimo for giving insight w.r.t working.
Regards,
-Alvi