Richard Coffre
asked on
! nn and !! with ksh
Hi all,
Now I can use ksh from csh but I face another issues :
- when I enter !! it raises ksh: !!: not found
- when I want to reexecute a command under ksh e.g. : ! nn, it have : ksh: 114: not found.
Thanks in advance.
Now I can use ksh from csh but I face another issues :
- when I enter !! it raises ksh: !!: not found
- when I want to reexecute a command under ksh e.g. : ! nn, it have : ksh: 114: not found.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you're using the vi editor as yuzh suggested, r nn is the same as !nn:
>history
1 ls
2 cd /
3 grep "hello" file
>r 2
cd /
>history
1 ls
2 cd /
3 grep "hello" file
>r 2
cd /
ASKER
Hi Werner,
When is the file .env loaded ?
Do I have to source it manually ?
Thanks ina advance
When is the file .env loaded ?
Do I have to source it manually ?
Thanks ina advance
No, as soon as you type your "ksh" the shell will source your .env file (locate it in your home directory). To test (I use that to debug these scripts) just put a "echo Now in .env" in the first line of .env. You should see that text as soon as you start ksh.
======
Werner
======
Werner
And if it is not working, ksh is looking for an environment variable 'ENV' that points to the .env file.
So you should set in your cshell login:
setenv ENV=$HOME/.env
======
Werner
So you should set in your cshell login:
setenv ENV=$HOME/.env
======
Werner
And if you need a good book, try "Bolsky/Korn : The New Kornshell, command and programming Language" (Prentice Hall PTR)
======
Werner
======
Werner
Hi pyxos,
Not all favour of UNIX system come with .env now. eg. Solaris, SCO and Debian (Linux) etc. that's why I tell you
to put:
export ENV=$HOME/.kshrc in your .profile
by the way, the env command tell you all your enviroment
variables settings.
"source" is a csh/tcsh term!
If you default shell is ksh, when you login, it first look at .profile and .kshrc file in your home dir, otherwise, it look for a systems wide profile file.
I hope that this infor help.
Regards
yuzh
Not all favour of UNIX system come with .env now. eg. Solaris, SCO and Debian (Linux) etc. that's why I tell you
to put:
export ENV=$HOME/.kshrc in your .profile
by the way, the env command tell you all your enviroment
variables settings.
"source" is a csh/tcsh term!
If you default shell is ksh, when you login, it first look at .profile and .kshrc file in your home dir, otherwise, it look for a systems wide profile file.
I hope that this infor help.
Regards
yuzh
Hi pyxos,
As Werner said, if yor prefer to use emacs, you just need to replace my vi with emacs and put it in your .profile or .kshrc file, it should work.
I think vi is more powerfull.
Regards
yuzh
As Werner said, if yor prefer to use emacs, you just need to replace my vi with emacs and put it in your .profile or .kshrc file, it should work.
I think vi is more powerfull.
Regards
yuzh
yuzh
>> Not all favour of UNIX system come with .env now. eg. Solaris, SCO and Debian (Linux) etc. that's why I tell you
to put: export ENV=$HOME/.kshrc in your .profile
What do you mean with that?
It doesn't matter what name the file has. It is important that the ENV variable is set to point to that file! What would be more obvious to use .env for ENV?
Anyway, the .profile is the file used when your login shell is ksh, csh uses .login and .cshrc. So setting the ENV in .profile will only help when your login shell is ksh.
======
Werner
>> Not all favour of UNIX system come with .env now. eg. Solaris, SCO and Debian (Linux) etc. that's why I tell you
to put: export ENV=$HOME/.kshrc in your .profile
What do you mean with that?
It doesn't matter what name the file has. It is important that the ENV variable is set to point to that file! What would be more obvious to use .env for ENV?
Anyway, the .profile is the file used when your login shell is ksh, csh uses .login and .cshrc. So setting the ENV in .profile will only help when your login shell is ksh.
======
Werner
Hi griessh ,
When people use something like:
export ENV=File-name
it will do the job as long as the file has all the ENV settings, by convention, the ksh people trend to use .kshrc as the file name.
Cheers
yuzh
When people use something like:
export ENV=File-name
it will do the job as long as the file has all the ENV settings, by convention, the ksh people trend to use .kshrc as the file name.
Cheers
yuzh
yuzh
I doubt that. I know many people using the .env convention and if you look into the kornshell book I mentioned (oneof the authors is David Korn!) they use the .profile for login and the ENV variable without mentioning a name.
======
Werner
I doubt that. I know many people using the .env convention and if you look into the kornshell book I mentioned (oneof the authors is David Korn!) they use the .profile for login and the ENV variable without mentioning a name.
======
Werner
Hi Werner,
I think the purpose for this website is for helpping people or getting help from other people, not for arguing.
It happen I have a few books on my book case, please check them
out:
The Korn Shell user & programming Manual
-by Anatole Olczak
UNIX Clearly Explained
-by Richard L Petersen
A Practical Guide to the UNIX System
-by M. G. Sobell
SCO UNIX user's manual
And
"Best UNIX Tips EVER"
they all talking about .kshrc.
============== END======================= ========== =====
yuzh
I think the purpose for this website is for helpping people or getting help from other people, not for arguing.
It happen I have a few books on my book case, please check them
out:
The Korn Shell user & programming Manual
-by Anatole Olczak
UNIX Clearly Explained
-by Richard L Petersen
A Practical Guide to the UNIX System
-by M. G. Sobell
SCO UNIX user's manual
And
"Best UNIX Tips EVER"
they all talking about .kshrc.
============== END=======================
yuzh
yuzh
That's great! And David Korn uses .... ENV
======
Werner
That's great! And David Korn uses .... ENV
======
Werner
In your .env file, add:
set -o emacs
# Arrows
#
alias __A=^P # uparrow
alias __B=^N # down arrow
alias __C=^F # left arrow
alias __D=^B # right arrow
to use the arrow keys on your keyboard to go back and forth in your history.
(The ^P is a Ctrl+P key, same for the others ...)
======
Werner