- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to interpret this script?
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
06-14-2002 01:41 AM
06-14-2002 01:41 AM
Thanks,
#cat .profile
...
ENV='${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'
START=$HOME/.kshrc
export ENV START
#cat .kshrc
set -o vi
set -o monitor
alias ll='ls -la'
setprmt='PS1=$HOST"["$USER"]:"${PWD##*/}" "'
setprmt
alias cd=newcd
function newcd
{
\cd "$@" >&- || return 1
setprmt
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 02:03 AM
06-14-2002 02:03 AM
Re: How to interpret this script?
Did you mistype the double-quotes as single-quotes?
ENV='${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'
will simply assign the string in the single quotes ''
${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}
to the ENV variable
Thus echo $ENV will give you the literal string:
${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 02:44 AM
06-14-2002 02:44 AM
Re: How to interpret this script?
The variable $- gives you the options given to ksh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 12:54 AM
06-17-2002 12:54 AM
Re: How to interpret this script?
Yes, this script cannot work. But anyidea on how to make it work?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 10:05 AM
06-17-2002 10:05 AM
Re: How to interpret this script?
This member has assigned points to 21 of 242 responses to his/her questions.
LESS THAN 10%???
http://forums.itrc.hp.com/cm/UserProfile/1,,CA698738!1,00.html
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 10:30 AM
06-17-2002 10:30 AM
Re: How to interpret this script?
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x96b70bce6f33d6118fff0090279cd0f9,00.html
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 04:58 PM
06-17-2002 04:58 PM
Re: How to interpret this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 05:16 PM
06-17-2002 05:16 PM
Re: How to interpret this script?
Now with the new feature on our "profiles" you have the ability to see all of the threads that you have started.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 06:12 PM
06-17-2002 06:12 PM
Re: How to interpret this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 06:23 PM
06-17-2002 06:23 PM
Re: How to interpret this script?
Thats why you have a value between 1 and 10 - depending on how helpful the answer is for you - If you assign less than 8 , it is assumed that the answer has not been provided -
entering N/A does not close the post
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 06:51 PM
06-17-2002 06:51 PM
Re: How to interpret this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2002 01:51 AM
06-18-2002 01:51 AM
Re: How to interpret this script?
*What* does not work? Only the "ENV=..." statement? What results do you get, i.e. (error) message(s), etc.?
As far as I can tell, your "ENV=...", "START=..." and "export ENV START" statements are correct, assuming you are using a *login* *Korn* shell, i.e. if this is (X) 'windows' related, i.e. CDE, VUE, etc., then it may just be a question of .profile not being executed.
Minor point: The ENV and START statements are 'the wrong way around', i.e. START is used in ENV, but is defined *after* ENV. While, as far as I know, this should matter because this stuff is exported and then executed, it is better to put them in logical order.
For what it is worth, this rather complex "ENV=" statement is apparently documented in the "Shell's User Guide" Chapter 23 and Korn's book on ksh.
[My reference: A4678466]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2002 10:32 PM
06-18-2002 10:32 PM
Re: How to interpret this script?
...
TZ=SST-8
ENV=${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}
START=/home/opc_op/.kshrc
...
Actually I don't understand what this ENV command will do, I just copy this from .profile of user opc_op which was automatically created by OpenView ITO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 03:19 AM
06-20-2002 03:19 AM
SolutionSpecifically:
"23 Advanced Concepts and Commands" -> "The ENV Variable".
This is referenced in "POSIX and Korn Shell" -> "16 Starting and Stopping the Shell" -> "Setting Up .profile and .kshrc".
The "Shells: User's Guide" should be supplied with your system. An an HTML version is available at <> and a PDF version at <>.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 05:22 PM
06-20-2002 05:22 PM
Re: How to interpret this script?
$ echo $ENV[0]
${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}[0]
$ echo $START[0]
/home/opc_op/.kshrc[0]
Does it work?
Additionally, how do I know if interactive shell or noninteractive shell is required in .profile of user opc_op which was created by OpenView ITO? Usually after login as opc_op, we would run opc to start ITO.
I think you may want to see .kshrc, here it is,
$cat .kshrc
set -o vi
set -o monitor
alias ll='ls -la'
alias setprmt='PS1=$HOST"["$USER"]:"${PWD##*/}" "'
setprmt
alias cd=newcd
function newcd
{
\cd "$@" >&- || return 1
setprmt
}
$alias
autoload=typeset -fu
cat=/usr/bin/cat
cd=newcd
false=let 0
functions=typeset -f
hash=alias -t -
history=fc -l
integer=typeset -i
ll=ls -la
ls=/usr/bin/ls
nohup=nohup
r=fc -e -
setprmt=PS1=$HOST"["$USER"]:"${PWD##*/}" "
stop=kill -STOP
suspend=kill -STOP $$
true=:
type=whence -v
$cd
newcd[2]: @: parameter not set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 05:34 PM
06-20-2002 05:34 PM
Re: How to interpret this script?
this line in function newcd is correct?
\cd "$@" >&- || return 1
Why need "\"? What is &-? Are these specifically for ksh?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2002 03:33 AM
06-21-2002 03:33 AM
Re: How to interpret this script?
Because you get a "newcd[2]: @: parameter not set" error message when you do a "cd" and that "newcd" alias is defined in .kshrc, it looks like .kshrc is executed on startup of a login shell and hence the START= and ENV= statements seem to be working.
To be absolutely sure, why don't you put a few simple "echo Start of .kshrc" and "echo End of .kshrc" in .kshrc, so you will *see* when it is (not) executed?
I can not comment on the OpenView ITO aspects.
Also I let the newcd alias to others who may know its source/use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2002 04:48 AM
06-21-2002 04:48 AM
Re: How to interpret this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2002 07:00 PM
06-23-2002 07:00 PM
Re: How to interpret this script?
How do I know whether I am running in interactive or non-interactive shell and how to switch from one to another? Because according to SHELL GUIDE, .kshrc will only be run under interacetive shell.
$ set -o
and look for:
interactive on
When can I see it becomes off or how to set it to off?
Is it true that .kshrc can only be run through .profile, It is normally something like ENV=~/.kshrc?
As for newcd, I think I need to post it as another question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2002 03:40 AM
06-24-2002 03:40 AM
Re: How to interpret this script?
Specifically, from the ksh(1) manual page (description of "-i" option):
> If the -i option is present or if the shell input
> and output are attached to a terminal (as reported
> by tty(3C)), the shell is interactive.
For future situations: You could have found this yourself by sending the (ksh(1)) manual page to a file and then using vi(1) or view(1) and look for the desired word(s), i.e.
$ man ksh | col -b >/tmp/ksh.man
$ view /tmp/ksh.man
[In view(1):]
/interactive
n
n
[etc.]
ZZ
$
Note: The "| col -b" strips the highlighting from the output, so what remains is plain ASCII text, which can be view(1)-ed, searched, etc..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2002 05:11 PM
06-24-2002 05:11 PM
Re: How to interpret this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2002 02:53 AM
06-26-2002 02:53 AM
Re: How to interpret this script?
> is ">&-", the close standard output, is it
> different from normal 1> or 2> ?
As the (ksh or other) manual page says, ">&-" closes standard output, i.e. for example this command gives no output:
echo message >&-
"2>&-" closes standard error, i.e. for example this command gives no error message:
ll file_which_does_not_exist 2>&-
For what it is worth, I see little use for ">&-" and "2>&-". Normally ">/dev/null" and "2>/dev/null" is much clearer. About the only use I can think of is:
exec >&-
which means close standard output for *all* subsequent commands (likewise for "exec 2>&-").
I don't know why ">&-" is used in 'your' case, i.e. the newcd alias. I think it should be "2>&-", because cd does not generate output, but can generate an error. Perhaps it has to do with the stuff ("\"?) mentioned in your "Why my newcd got problem?" thread (<>).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2003 09:31 PM
05-19-2003 09:31 PM
Re: How to interpret this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2003 09:35 PM
05-19-2003 09:35 PM
Re: How to interpret this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2003 09:41 PM
05-19-2003 09:41 PM