1753613 Members
5780 Online
108797 Solutions
New Discussion юеВ

why "!" is not working?

 
Manuales
Super Advisor

why "!" is not working?

$ history
1 ls -lrt .sh*
2 cat /etc/passwd | grep muser1
3 history
4 !1
5 history 1
6 history 2
7 man history
8 1!
9 ksh
10 ls -lrt
11 history
$ !1
ksh: !1: not found


thanks in advance.
$
5 REPLIES 5
Steven Schweda
Honored Contributor

Re: why "!" is not working?

> why "!" is not working?

Because you're using ksh, not csh?

man ksh

http://docs.hp.com/en/B2355-60130/ksh.1.html

Compare:

man csh

http://docs.hp.com/en/B2355-60130/csh.1.html
Manuales
Super Advisor

Re: why "!" is not working?

I am using csh:

$ whoami
user1
$ echo $SHELL
/usr/bin/csh
$ !!
su: !!: not found.
$ hostname
server1
Steven Schweda
Honored Contributor

Re: why "!" is not working?

> I am using csh:

If you say so. But then please explain why
your error message said "ksh: !1: not found".
Are my eyes failing me, or do I see a "k" in
there, and not a "c"?
Bill Hassell
Honored Contributor

Re: why "!" is not working?

> echo $SHELL

This tells you nothing about the actual shell you are running. SHELL is set when you login but is not changed when you type something like ksh. These are the commands:

echo $0
ps -f

These will show what you are actually running.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: why "!" is not working?

>Bill: These will show what you are actually running.

Or "ps -fp $$".
Or if you are running a real shell, to get all of your trees:
UNIX95=EXTENDED_PS ps -H -fu $LOGNAME