LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-17-2004, 01:28 PM   #1
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Rep: Reputation: 47
The ksh command


I wrote the following command and it didn't work. Do you know why?
[heden@h216n2fls301o1037 heden$ ksh
bash: ksh: command not found

---------------------------------------------------------------------
The sh command worked fine.
[heden@h216n2fls301o1037 heden]$ sh
sh-2.05b$


Even the csh command worked fine.
[heden@h216n2fls301o1037 heden]$ csh
[heden@h216n2fls301o1037 ~]$



The bash command worked too.
[heden@h216n2fls301o1037 heden$ bash
[heden@h216n2fls301o1037 heden]$

((I believe that I am sitting in the bash folder. That is why I can't see any deviated result. Please tell me if my understanding is incorrect.))

Last edited by Gins; 11-17-2004 at 01:31 PM.
 
Old 11-17-2004, 01:45 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Maybe ksh isn't installed, not all distro's do it by default.

$ which ksh or $ locate ksh should tell you more.
You can also take a look in the /bin directory. ksh (or a link poiting to antother location) should be there. No ksh (or link) will tell you that ksh is probably not installed.

If you want to find out what your default shell is, take a look at the /etc/passwd file. The last field will tell you what the default shell is. Most of the time this is a bash shell.

Another way to check (if it wasn't changed) is the prompt:

$ => bash
# => ksh
% => csh

Hope this helps.
 
Old 11-17-2004, 02:32 PM   #3
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
The following are the output of the which and locate commands?

[heden@h216n2fls301o1037 heden]$ $ which ksh
bash: $: command not found


[heden@h216n2fls301o1037 heden$ $ locate ksh
bash: $: command not found
 
Old 11-17-2004, 02:39 PM   #4
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
The following is the output passwd file. I just wrote the cat command. For the best of my knowledge of Linux, the default shell is bash. Please tell me if I am wrong.


[heden@h216n2fls301o1037 etc]$ cat passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/sh
daemon:x:2:2:daemon:/sbin:/bin/sh
adm:x:3:4:adm:/var/adm:/bin/sh
lp:x:4:7:lp:/var/spool/lpd:/bin/sh
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/bin/sh
news:x:9:13:news:/var/spool/news:/bin/sh
uucp:x:10:14:uucp:/var/spool/uucp:/bin/sh
operator:x:11:0perator:/var:/bin/sh
games:x:12:100:games:/usr/games:/bin/sh
nobody:x:65534:65534:Nobody:/:/bin/sh
rpm:x:13:101:system user for rpm:/var/lib/rpm:/bin/false
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
rpc:x:70:70:system user for portmap:/:/bin/false
xfs:x:71:71:system user for XFree86:/etc/X11/fs:/bin/false
postfix:x:72:72:system user for postfix:/var/spool/postfix:/bin/false
heden:x:501:501:nissanka:/home/heden:/bin/bash
[heden@h216n2fls301o1037 etc]$
 
Old 11-17-2004, 02:52 PM   #5
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
As you see the below, the csh gives me a different prompt.

[hedn@h216n2fls301o1037 heden]$ csh
[heden@h216n2fls301o1037 ~]$





[heden@h216n2fls301o1037 heden]$ bash
[heden@h216n2fls301o1037 heden]$


The ksh is hopeless. The answer is command not found.
 
Old 11-17-2004, 02:52 PM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
[heden@h216n2fls301o1037 heden]$ $ which ksh
You should not use the extra $. This is also what bash is trying to tell you: bash: $: command not found. The $ is the name of the program bash tries to execute.

Like I stated before, last field of the passwd file:

heden:x:501:501:nissanka:/home/heden:/bin/bash

So you are correct, you are using a bash shell.

Hope this clears things up a bit.
 
Old 11-17-2004, 02:59 PM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
As you see the below, the csh gives me a different prompt.
[hedn@h216n2fls301o1037 heden]$ csh
[heden@h216n2fls301o1037 ~]$
The ksh is hopeless. The answer is command not found.
The prompt is easy to change to something else and distro's do. The way it 'should be done' (nope, don't want a discussion about this ) is the way I described above. But, as you found out yourself, it's not always so.

If all the options to check for ksh failed then ksh is not installed.
 
Old 11-17-2004, 03:05 PM   #8
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
The following is the output of the ls command. There is no ksh, as far as I can see.

[heden@h216n2fls301o1037 bin]$ ls
arch* cut* false* hostname* mkdir* ps* stat* vi@
awk@ date* fbmngplay.static* id* mknod* pwd* stty* view@
basename* dd* fbresolution* igawk* mktemp* rbash@ su* vim@
bash* df* fbtruetype.static* ipcalc* more* red@ sync* vim-minimal*
bash2@ dmesg* fgrep* ipv6calc* mount* rm* tar* ypdomainname@
cat* dnsdomainname@ find* kill* mv* rmdir* tcsh* zcat*
chgrp* doexec* gawk* link* netstat* rpm* touch*
chmod* domainname@ gawk-3.1.2@ ln* nice* rvi@ true*
chown* echo* gettext* loadkeys* nisdomainname@ rview@ umount*
consolechars* ed* grep* login* open* sed* uname*
cp* egrep* gtar@ ls* ping* sh@ unicode_start*
cpio* env* gunzip* lsb_release* procps3-kill* sleep* unlink*
csh@ ex@ gzip* mail* progress* sort* usleep*
[nissanka@h216n2fls301o1037 bin]$ ls -a






--------------------------------------------------------------------------------------------------------------------

The following is the result of the ls -a command:
[heden@h216n2fls301o1037 bin]$ ls -a

./ cpio* env* gunzip* lsb_release* procps3-kill* sleep* unlink*
../ csh@ ex@ gzip* mail* progress* sort* usleep*
arch* cut* false* hostname* mkdir* ps* stat* vi@
awk@ date* fbmngplay.static* id* mknod* pwd* stty* view@
basename* dd* fbresolution* igawk* mktemp* rbash@ su* vim@
bash* df* fbtruetype.static* ipcalc* more* red@ sync* vim-minimal*
bash2@ dmesg* fgrep* ipv6calc* mount* rm* tar* ypdomainname@
cat* dnsdomainname@ find* kill* mv* rmdir* tcsh* zcat*
chgrp* doexec* gawk* link* netstat* rpm* touch*
chmod* domainname@ gawk-3.1.2@ ln* nice* rvi@ true*
chown* echo* gettext* loadkeys* nisdomainname@ rview@ umount*
consolechars* ed* grep* login* open* sed* uname*
cp* egrep* gtar@ ls* ping* sh@ unicode_start*
[heden@h216n2fls301o1037 bin]$
 
Old 11-17-2004, 03:12 PM   #9
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
So here is the correct use of which ush command and the output I received.

[heden@h216n2fls301o1037 heden]$ which ksh
which: no ksh in (/usr/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/:/usr/games:/home/heden/bin)
-----------------------------------------------------------------------------------------------------

The locate gave me the following:

[heden@h216n2fls301o1037 heden]$ locate ksh
warning: locate: could not open database: /var/lib/slocate/slocate.db: No such file or directory
warning: You need to run the 'updatedb' command (as root) to create the database.
[
 
Old 11-17-2004, 03:39 PM   #10
XsuX
Member
 
Registered: Oct 2004
Location: US
Distribution: Fedora Core 1
Posts: 43

Rep: Reputation: 15
So it looks like you just don't have ksh installed
 
Old 11-20-2004, 06:56 PM   #11
UnxLnx
LQ Newbie
 
Registered: Nov 2004
Location: NYC
Distribution: Suse 9.1 Pro
Posts: 2

Rep: Reputation: 0
I believe that your error is from /bin/ksh not being installed on your system. There should be (there are in Unix) both a /sbin and a /bin directory on your system. If you ls the directory:

$ ls /bin

or

$ ls /sbin

you will then see the shells that are installed on your system (i.e. bash, csh, etc.).

You should be able to download and compile the ksh source code on your Linux box. Since our company software requires this shell and it is not installed on my new Suse 9.1 Pro, I am hunting for the software too and found it at:


http://www.kornshell.com


I hope that this helps us both!


Last edited by UnxLnx; 11-20-2004 at 06:59 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ksh : Command not found aashish_us2002 Linux - Software 15 03-13-2006 04:26 AM
where is my /bin/ksh ']['HeBroken Linux - Software 2 03-11-2006 04:25 PM
The command ksh doesn't work Gins Linux - General 18 12-10-2004 12:57 AM
Help with command line options(ksh) SeT Programming 2 11-29-2004 06:54 PM
Can somebody help me with a ksh script? twentymil AIX 7 01-21-2004 09:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration