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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set -o vi

Status
Not open for further replies.

kozlow

MIS
Mar 3, 2003
326
0
0
US
I was wondering if you can display your last commands like you can in AIX and HP-UX. In AIX I run the set -o vi command and then am able to pull the last commands out of my .sh-history with the esc-K key sequence.

I am new to Solaris and know that in UNIX, everything you want to do, can be done in at least 10 different ways....
 
You're right. That is the beauty of these operating systems. &quot;There is more than one way to skin a cat.&quot; (set -o vi) is exclusive to Korne Shell. Which allow you to recall and edit previous commands. In older versions of Unix, you used to be able to run (set filec) which would do the same. These days, I have resorted to using the ol' (fc -l) to get a list of the previous commands and (!<command number> or !! for the last command).

HTH,

- DM
 
Change to ksh bye exequeting ksh command or
change entry on /etc/passwd file to
root:x:0:1:Super-User:/:/usr/bin/ksh it will start ksh mode
at system logon.
 
Korn shell runs exactly the same on Solaris. Check your current shell 'echo $SHELL' - if not ksh then 'ksh -o vi' will invoke the korn shell with the vi editor option.

As has been mentioned here before it is best not to tamper with root shell as the default /sbin/sh is statically linked to enable login even if / is the only filesystem available. If you want to switch root to ksh do it in the .profile only after testing it is there.

if [ -x /usr/bin/ksh ]
then
echo &quot;Starting ksh...&quot;
/usr/bin/ksh -o vi
fi
 
you can also use tcsh. It is very similar to linux's bash shell.

On solaris 8 and maybe soem of the other releases prior to 8, bash is installed by default. And bash will do what you need as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top