"/" doesn't work on command prompt for searching commands last typed


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Operating Systems AIX "/" doesn't work on command prompt for searching commands last typed
# 1  
"/" doesn't work on command prompt for searching commands last typed

When I use "/" to look for a particular command that I typed in the current session it says

D02:-/home/user1/temp> /job
ksh: /job: not found.
D02:-/home/user1/temp>

previously it used to fetch all the commands which had job in it..
for example subjob, endjob, joblist etc...

may I know where am I going wrong..?

I use putty to access unix aix.. Thanks

Last edited by meetzap; 08-16-2010 at 07:28 AM..
# 2  
The problem seems to be your command line editor setting. "/" is only available in the so-called "vi-mode" of ksh, which is invoked by

Code:
set -o vi

You can enter this either on the command line (valid only for this invocation of the ksh) or in your "~/.kshrc" (automatically read by all invocations of ksh by this user account).

There are other modes of command line editing, which might or may not suit you: "gmacs" ("set -o gmacs") invokes a gmacs-style command line editor, and "emacs" ("set -o emacs"), which switches the command line to behave like the EMACS editor.

There is ample documentation of the benefits for all of these possibilities, my favoured vi-style is described here, for example.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 3  
Hi Bakunin, thanks for quick reply..

I think my VI command line editing mode is already on.. as I can use all the other vi commands on the command mode except for "/"

I tried "set -o vi" on command prompt as well as .profile..
but still not able to search history of commands.. Smilie
Don't know where am I going wrong..
# 4  
Make sure that the user in question is actually create a ~/.sh_history file. If this file doesn't exist then there is no history to search.

What happens if you type history at the command prompt?
# 5  
@ross.mather
Thanks for reply..

when I type history...

D02:-/home/user1/data> history
2301 lsd
2302 lsrt
.
.
.
.2316 history

I get the history of typed commands, so what u r saying is not the problem.. ( i.e. .sh_history file is created.. )
# 6  
Quote:
Originally Posted by meetzap
D02:-/home/user1/temp> /job
ksh: /job: not found.
D02:-/home/user1/temp>
OK I see what you've done, when you use / on the command line like that, AIX thinks you are trying to run a command called /job. What you need to do if you are in vi mode is to press Escape and then do /job:

You may need to press n a couple of times to get over the commands you've already entered as /job on the command line.
# 7  
Quote:
Originally Posted by meetzap
I think my VI command line editing mode is already on.. as I can use all the other vi commands on the command mode except for "/"
I this case it might be that your shell is configured not to write any command history. Per default the command history is saved to a file named "~/.sh_history", which can be viewed/edited like any other ordinary text file. You can also try the commands "last" and "history" to view the contents of the history file. It might be that you have either configured no history to be written or configured a history file which isn't writeable somehow or something similar. How to configure the history file is in the man page of ksh ("man ksh").

Another possibility is that the "ESC" character is not working somehow, because you said in your first post:

Quote:
When I use "/" to look for a particular command that I typed in the current session it says

D02:-/home/user1/temp> /job
ksh: /job: not found.
It seems that you simply entered "/job" instead of "<ESC>/job". Find out if your ESC key is working and make sure it has the correct key mapping.

Quote:
Originally Posted by meetzap
I tried "set -o vi" on command prompt as well as .profile..
You shouldn't set this in your "~/.profile", but in your "~/.kshrc". The difference is a subtly yet important one: the profile is read every time you log in, the .kshrc is read every time you start a shell. Of course, when you log in you start a shell too, so there is no difference in this case. But if you start another shell instance (for instance by issuing "ksh" on the command line) your "~/.kshrc" will be executed while your "~/.profile" will not.

The correct way to set the ksh environment is to put everything which should be set in every ksh-instance into "~/.kshrc" and to write "ENV=~/.kshrc ; export ENV" as the last line in your "~/.profile".

I hope this helps.

bakunin

Last edited by bakunin; 08-16-2010 at 09:49 AM..
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #957
Difficulty: Medium
Metamorphic code is code that when run outputs a logically equivalent version of its own code under some interpretation.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script: "mkdir -p" doesn't work with var(cat x)

Hello, :) I've an issue with the creation of a directory, All work without it :mad: So, below, my scripts with the debug output : #!/bin/bash # PATHS HOME_BACKUP="/home/backup" HOME_SCRIPT="/home/scripts/test/backup_server" TARGET="/var/www" # DATE DATE_Ymd=$(date +%Y-%m-%d) #... (1 Reply)
Discussion started by: Arnaudh78
1 Replies

2. Shell Programming and Scripting

Why doesn't "grep -w" ALWAYS work?

Working with IP addresses is a pain... Here's my problem: I'm putting some interface information to a file: 3.185.201.2 | Tu1102 152.162.54.130 | Gi0/2.36 3.185.226.2 | Gi0/1 3.185.0.82 | Tu1 ... (12 Replies)
Discussion started by: turk22
12 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. AIX

AIX 5.3 on p275 - "|" key doesn't work (!)

More issues. The "|" key doesn't work at all, either in the text terminal or in mwm (which starts fine when I do "startx"). How am I supposed to troubleshoot without a "|" key? (2 Replies)
Discussion started by: smithfarm
2 Replies

5. OS X (Apple)

Neither "which" nor "find" commands work

hi there, could use some basic PATH advice, i think, or something find sometimes work, but which hasn't ever seemed to. for years! what am i doing wrong that the commands which and find rarely work? they used to work on the workstations i used ages ago... running 10.5.8 because i... (4 Replies)
Discussion started by: zensnob
4 Replies

6. UNIX for Dummies Questions & Answers

Help! "grep" doesn't work for me!

totally pis*ed off. I have a data set (xxx.txt), as follows: chr1 3821 rs127372 A/C 0.823 chr1 3822 rs127376 A/C/G 0.899 chr1 3722 rs612634 A/C 9.22 chr1 3262 rs7152 A/T 0.22 chr1 3711 rs737 A/C/G 0.2323 ....... I only want to get those lines... (6 Replies)
Discussion started by: kaixinsjtu
6 Replies

7. UNIX for Advanced & Expert Users

sometimes "ps -elf" command doesn't work

when i give "ps -elf" or "ps" system gets hung. if i press "^c" come out from it... pls help..what should i do to get it resolved. thanks CKanth (4 Replies)
Discussion started by: srikanthus2002
4 Replies

8. Linux

By angle-brackets/"pipe" button doesn't work?

How can I configure it? I have a swedish keyboard with swedish keyboard setting. Everything works perfectly (едц) except that button. What can be wrong? /Richard ++ NOTE: It seems like the computer notices the input but that the button isn't assigned to anything (the keyboard-cursor stops).... (1 Reply)
Discussion started by: riwa
1 Replies

9. UNIX for Dummies Questions & Answers

Why "@z=$x+$y" doesn't work?

253 lab2-36:~/try_direct/another> set x=1;set y=2;@z=$x+$y @z=1+2: Command not found. 254 lab2-36:~/try_direct/another> (11 Replies)
Discussion started by: endeavour1985
11 Replies

10. Shell Programming and Scripting

my "case" doesn't work !

I'm using the case statement in the following script and it always takes the "*" default choice while it should be "3". I wonder why ??? dt_auj=`date +%d` NBLOG=`ls -al /users/notes01/LOG/t*|awk '{print $7}'|grep $dt_auj|wc -l` case $NBLOG in 1) cat ~/LOG/console-notes > $fic_tmp1 ;; 2)... (5 Replies)
Discussion started by: Nicol
5 Replies

Featured Tech Videos