Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

seeing old commands 1

Status
Not open for further replies.

Chrissirhc

Programmer
May 20, 2000
926
GB
Hi,

I have some unix accounts and I run ksh on both of them.

On one account I can press the escape key and then "j" and "k" to go through my history of commands. I can also edit them using vi commands.

Why is this on one account and not other? Is it not shell related?

Thanks,

Chris
 
Thanks,

I haven't got access to .profile, however my .profile.mine files are the same. Do you know the exact command to add this functionality? I could add it to my .profile.mine in the account that doesn't have it.

thanks,

Chris
 
Thanks, however it didn't work I still get ^[ when I press the escape key...
 
export EDITOR=vi; set -o vi

Hope This Help
PH.
 
Hi,

Thanks,

I have all this in my .profile.mine. However when I run the commands from the shell it works. I think its something to do with the default shell (I think its c shell). So it looks like my .profile.mine isn't running.

Any ideas?

Thanks,

Chris
 
What is the result of echo $SHELL ?


Hope This Help
PH.
 
the result is /bin/csh. Although I am actually in a kornshell. I put that in my .mycshrc file. and in my .profile.mine (not sure if that ones getting run).

Any ideas?

 
Why don't ask your administrator for having ksh as the login shell ?

Hope This Help
PH.
 
cshs to change your shell. Copy .profile.mine to .profile and add set - vi in it.

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Thanks for your suggestions... Is asking the administrator the only way to get the shell to change? Is there not a personal file such as .profile.mine .crhcsh that allows this kind of personalisation?

Hi Morsing, the cshs command didn't seem to work.

Thanks a lot for all your help.

Chris
 

I was typing too fast: It's chsh as in CHange SHell.

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Hi Morsing,

I couldn't find the chsh command. I did a quick find from root to see if the executable was there, but didn't find anything.

Any other ideas?

Thanks,

Chris
 
Hi,

What I don't understand is that when I run the commands from the shell individually as follows;

ksh
export VISUAL=vi
set -o vi

I get the environment I want. If I put them in a shell script then the line 2 and 3 don't seem to take affect. Why is that? (Also when I put the lines in .mycshrc it doesn't work either)...

Thanks,

Chris



 
In your cshrc try to add something like this:
Code:
setenv VISUAL vi
exec ksh -o vi

Hope This Help
PH.
 
Thanks.

So I guess what we did was set the environemt variable with setenv as that is what c shell needs as opposed to export.

And then rather than just ksh -o vi we did exec ksh -o vi... I'm not sure why that is?
 
if you are working with csh then you need to change your .cshrc file to include the following line
setenv VISUAL vi

IF you do not have write access to this file you jwill have read access. Have a look at it and see which commands/scripts are being executed, and if one of them is your .profile.mine then change this last one. If not then post the .cshrc file here or ask your system administrator to do this change for you, explaining the reason why.

Once you have VISUAL set when you login then you just need to issue a "ksh" command to change to ksh, and this time with the possibility of using the "vi" mode.




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
I suggested exec to simply replace the csh instance in memory with a ksh one.
 
PHV,

if variable VISUAL is set to "vi" then the "-o vi" is not needed as ksh will set it by default depending on the VISUAL variable

Chrissirhc,

the "exec ksh ..." will transfer control completely to the new shell and ends the previous one, instead of being a shell within a shell.




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top