sh is a symlink to bash but man sh shows man page of ksh
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well.
Yes, that is probably a misconfiguration of man pages.
I can replicate this on an updated machine, while on a fresh installed one (a couple of hours ago)
Code:
$ man sh
No manual entry for sh
I also don't have a man page for sh on my 14.2 install, but if I check on my htpc using an old version of -current (from around May 2019), that does bring up ksh's man page.
If I run man -w sh, it shows /usr/man/man1/ksh.1.gz
I'm not sure if that's a glitch with an older version of man or if there's something like a symlink that allows man to link to ksh when running it against sh.
I also don't have a man page for sh on my 14.2 install, but if I check on my htpc using an old version of -current (from around May 2019), that does bring up ksh's man page.
If I run man -w sh, it shows /usr/man/man1/ksh.1.gz
I'm not sure if that's a glitch with an older version of man or if there's something like a symlink that allows man to link to ksh when running it against sh.
I agree, on my 14.2 install:
Code:
$ man sh
No manual entry for sh
But on Pop!_OS 20.04 LTS (derivative of Ubuntu):
Code:
$ man -w sh
/usr/share/man/man1/dash.1.gz
$ find /usr/share/man -iname sh.*
/usr/share/man/man1/sh.1.gz
/usr/share/man/man1/sh.distrib.1.gz
$ ls -l /usr/share/man/man1/sh.1.gz
lrwxrwxrwx 1 root root 9 Jul 18 2019 /usr/share/man/man1/sh.1.gz -> dash.1.gz
$ ls -l /usr/share/man/man1/sh.distrib.1.gz
lrwxrwxrwx 1 root root 9 Jan 25 2018 /usr/share/man/man1/sh.distrib.1.gz -> dash.1.gz
So I'm guessing a symlink was created at some point on -current. Maybe try searching in /var/log/scripts and/or /var/log/removed_scripts/ ?
$ man -w sh
/usr/share/man/man1/dash.1.gz
$ find /usr/share/man -iname sh.*
/usr/share/man/man1/sh.1.gz
/usr/share/man/man1/sh.distrib.1.gz
$ ls -l /usr/share/man/man1/sh.1.gz
lrwxrwxrwx 1 root root 9 Jul 18 2019 /usr/share/man/man1/sh.1.gz -> dash.1.gz
$ ls -l /usr/share/man/man1/sh.distrib.1.gz
lrwxrwxrwx 1 root root 9 Jan 25 2018 /usr/share/man/man1/sh.distrib.1.gz -> dash.1.gz
So I'm guessing a symlink was created at some point on -current. Maybe try searching in /var/log/scripts and/or /var/log/removed_scripts/ ?
I did forget to mention that on my old -current system, there is no file or symlink for sh.1.gz, so I'm not sure how it links to ksh.1.gz when you run man -w sh
I did forget to mention that on my old -current system, there is no file or symlink for sh.1.gz, so I'm not sure how it links to ksh.1.gz when you run man -w sh
But if I don't have any sh.1.gz file or symlink, how did sh get mapped to ksh on my old -current? And why did 14.2 not have that happen and why does it not happen with a fresh install of -current?
I don't know a lot about man and how the index.db is created.
But if I don't have any sh.1.gz file or symlink, how did sh get mapped to ksh on my old -current? And why did 14.2 not have that happen and why does it not happen with a fresh install of -current?
I don't know a lot about man and how the index.db is created.
Wed Nov 29 08:15:09 UTC 2017
ap/man-1.6g-x86_64-3.txz: Removed.
ap/man-db-2.7.6.1-x86_64-1.txz: Added.
This package replaces the good old man package. Thanks to B. Watson.
ponce is the one who stated that a new install didn't show the issue, but looking at the doinst.sh, it seems database creation is commented out, so it wouldn't happen until cron is run at 4:40.
So, since you simply linked your old post when I asked how it happened, I'm assuming man-db actually looks in the man pages to generate its index rather than just filenames? I didn't know how the database was created, which is why I asked. Looking in the bash.1.gz file, there's also mentions of sh, so I'm not sure what portions man-db looks at to generate its cache. It seems most distros just symlink sh.1.gz with the system's preferred shell (and maybe that's the best option here if ksh.1.gz maps itself to sh because of text inside the man file).
So, since you simply linked your old post when I asked how it happened, I'm assuming man-db actually looks in the man pages to generate its index rather than just filenames? I didn't know how the database was created, which is why I asked.
Yes, I guess so. I think it's these two lines in my post:
Code:
.SH NAME
sh, rsh, pfsh \- shell, the standard/restricted command and programming language
Actually, it's inside an if Z=0, but it seems mandb does not take into account that Z=1. If it did, it would use this:
Code:
.SH NAME
ksh, rksh, pfksh \- KornShell, a standard/restricted command and programming language
("man pfsh" shows the man page, but "man pfksh" does not.)
Last edited by Petri Kaukasoina; 02-23-2021 at 03:56 PM.
Yes, I guess so. I think it's these two lines in my post:
Code:
.SH NAME
sh, rsh, pfsh \- shell, the standard/restricted command and programming language
Actually, it's inside an if Z=0, but it seems mandb does not take into account that Z=1. If it did, it would use this:
That line seems to be the cause because man pfsh also shows ksh (an rsh man page actually exists and loads using man rsh, so it looks like man-db will prioritize files over one commands specified in a man page).
Seems like if we want man sh to show bash (since that is the default shell), the best option would be to simply create a symlink for /usr/man/man1/sh.1.gz pointing to /usr/man/man1/bash.1.gz
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.