- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- don't want .kshrc to be soured when running a scri...
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
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
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
тАО12-28-2010 11:29 PM
тАО12-28-2010 11:29 PM
I have two servers but with different behaviors, sdb1 and dmc:
In sdb1, whatever script I run, the .kshrc seems to be sourced and exceuted, for example I have a simple script to print "Hello" with debug option enabled as
#! /bin/sh -x
echo "hello"
execute it, I will get
+ export PATH=/usr/sbin:/usr/sbin:/usr/sbin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/upgrade/bin:/opt/fcms/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/pd/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/resmon/bin:/opt/firefox:/opt/gnome/bin:/opt/mozilla:/opt/graphics/common/bin:/opt/hpsmh/bin:/opt/perl_32/bin:/opt/perl_64/bin:/usr/sbin/diag/contrib:/opt/sfm/bin:/opt/ssh/bin:/opt/thunderbird:/opt/gwlm/bin:/opt/OSSInstall/bin:/opt/platform7/bin:/opt/TSDCommon/bin:/opt/DataBroker/bin:/opt/a7healthCheck/bin:/opt/stcroamcommon/bin:/opt/ignite/bin:/sbin:/home/root:/sbin:/sbin:/sbin
+ umask 022
+ who am i -u
+ head -n1
+ read junk TTY junk
+ [[ ! -d //.sh_history ]]
+ echo pts/1
+ tr / .
+ export HISTFILE=//.sh_history/pts.1
+ unset junk TTY
+ set -o vi
+ PS1=s7sdb1 #
+ echo hello
hello
but on dmc,
I just get
s7dmc # ./ttest
+ echo hello
hello
Here I don't want .kshrc to be sourced and executed in sdb1. Can anybody tell me how?
I compared the .profile and .kshrc on both servers, and they look exactly similar execept some hostname settings.
Thanks in advance.
Best Regards
Kang
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2010 04:41 AM
тАО12-29-2010 04:41 AM
SolutionThis occurs if ENV is exported with the name of your ~/.kshrc file.
>Here I don't want .kshrc to be sourced and executed in sdb1. Can anybody tell me how?
There is a magic string that you can set ENV so that if it isn't interactive, it expands to empty.
export ENV='${FILE[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1116432
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=823049
- Tags:
- env
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2010 05:22 AM
тАО12-29-2010 05:22 AM
Re: don't want .kshrc to be soured when running a script, please tell me how
I have the same profile settings on both server, but different results for ENV
This server is what I want:
s7dmc # tail /.profile
# Set ENV file to source .kshrc if this is an interactive shell.
export ENV_FILE=/.kshrc
export ENV='${ENV_FILE[ (_$-= 1) + (_ = 0) - (_$- != _${-%%*i*}) ]}'
export ORACLE_HOME=/opt/oracle/product/9.2.0
export PATH=/usr/lbin/sw/bin:/var/adm/sw/sbin:/sbin:/usr/bin:/usr/ccs/bin:/usr/sbin:/usr/lbin/sw:/opt/oracle/product/9.2.0/bin
export TNS_ADMIN=/opt/oracle/product/9.2.0/network/admin
export ORACLE_SID=dmc
s7dmc # echo $ENV_FILE
/.kshrc
s7dmc # echo $ENV
${ENV_FILE[ (_$-= 1) + (_ = 0) - (_$- != _${-%%*i*}) ]}
This is not
s7sdb1 # echo $ENV_FILE
/.kshrc
s7sdb1 # tail /.profile
MAIL=/var/mail/root
# don't export, so only login shell checks.
echo "WARNING: YOU ARE SUPERUSER !!\n"
# Set ENV file to source .kshrc if this is an interactive shell.
export ENV_FILE=/.kshrc
export ENV=${ENV_FILE[ (_$-= 1) + (_ = 0) - (_$- != _${-%%*i*}) ]}
s7sdb1 # echo $ENV_FILE
/.kshrc
s7sdb1 # echo $ENV
/.kshrc
please suggest.
Thanks and Regards
Xie Kang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2010 05:27 AM
тАО12-29-2010 05:27 AM
Re: don't want .kshrc to be soured when running a script, please tell me how
Thanks.
Just notice in that line there is no '' in sdb1.
Regards
kang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2010 05:28 AM
тАО12-29-2010 05:28 AM