- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Regarding shell /bin/csh
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
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
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
04-19-2013 03:28 AM - last edited on 04-21-2013 09:11 PM by Maiko-I
04-19-2013 03:28 AM - last edited on 04-21-2013 09:11 PM by Maiko-I
Regarding shell /bin/csh
Hi,
We use the following lines in /etc/profile as below to create the log file with command executed by that user. We are using login shell as /usr/bin/sh and it is working fine.
export LOGINNAME=`who am i | awk '{print $1}'`
export HISTFILE="/var/tmp/hist_`date +%y%m%d.%H%M%S`.${LOGINNAME}.$LOGNAME.$$"
We are having some users who are having login shell as /bin/csh. I tried the same by putting below lines in /etc/csh.login and .cshrc. But it is not creating the log file in /var/tmp directory.
setenv LOGINNAME `who am i | awk '{print $1}'`
setenv HISTFILE "/var/tmp/hist_`date +%y%m%d.%H%M%S`.${LOGINNAME}.$LOGNAME.$$"
Please let me know what could be the problem for not creating the log file with command executed by that user in /var/tmp.
Thanks,
Narendra
P.S. this thread has been moved from HP-UX > System Administration to HP-UX > languages - HP Forums Moderator
- Tags:
- history
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2013 08:04 AM
04-19-2013 08:04 AM
Re: Regarding shell /bin/csh
The csh shell is widely considered a flawed design.
The variable HISTFILE has no special meaning in csh - the shell treats it as just another user-defined environment variable with no impact to the working of the shell.
The name of the csh shell history file is hardcoded as '~/.history' - apparently that is not changeable at all.
There are two variables that control how many commands are kept in the history buffer of the csh shell and how many of those are saved to ~/.history. These are not environment variables, but shell variables: you should use "set" and "unset" instead of "setenv" and "unsetenv" with them. The names of the variables are $history and $savehist (note lower case).
You can set these to large values, but not to "infinite", so as soon as the number of commands the user has entered in a session becomes greater than the value of $history, some of the oldest commands will be forgotten. And since the .history file will be written at logout time and only $savehist last commands will be recorded, it will be easy for the user to avoid logging even without modifying any shell settings: just run $savehist innocent commands after any evil command, and the evil command is guaranteed to not appear in the .history file.
But there is an even easier way to avoid .history "logging": since the shell variables apparently cannot be made immutable in csh, the user can simply run "unset savehist" or "set savehist 0" and the current session won't be recorded.
Because of these differences, I would say that your trick with /usr/bin/sh is not applicable to csh at all.
- Tags:
- scummy C shell