How to reinstall /bin/sh
25,568
Solution 1
Try sudo ln -s dash /bin/sh
. The "dash" package should already have set this symlink in its post-installation routines.
Solution 2
You can do
apt-get --reinstall install bash
Related videos on Youtube
Author by
Fingolfin
Updated on September 18, 2022Comments
-
Fingolfin over 1 year
I have accidentally deleted
/bin/sh
, and I am trying to to re-install it.
If I typesh
in the terminal, It saysThe program 'sh' can be found in the following packages: * bash * dash
If I try to
apt-get install bash
, I getbash is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 109 not upgraded.
So, how am I supposed to get
/bin/sh
back? -
Fingolfin over 12 yearsI tried that and I got the following: >E: Sub-process /usr/sbin/dpkg-preconfigure --apt || >true returned an error code (100) >E: Failure running script /usr/sbin/dpkg-preconfigure >--apt || true
-
jw013 over 12 years@AdelCKod Try
ln -s bash /bin/sh
, and then enzotib's answer. Also, learn from whatever mistake you made that resulted in the removal, and try to never make it again. -
amphetamachine over 12 yearsI think you mean bash...?
-
Arcege over 12 years
/bin/sh
is the Bourne shell equivalent, which in the case of the OP, isdash
. -
amphetamachine over 12 yearsI meant "I think you mean
sudo ln -s bash /bin/sh
." -
Arcege over 12 yearsNo, i meant what I said:
lrwxrwxrwx 1 root root 4 2011-05-03 11:01 /bin/sh -> dash
on Ubuntu; on Solaris and FreeBSD,/bin/sh
was a smaller, statically linked version of the Bourne shell; I can't remember about HP-UX, AIX and IRIX, but it wasn'tbash
. As I said,/bin/sh
should be the closest to the Bourne shell. If using bash syntax, then#!/bin/bash
should always be specified. -
Rizwan Khan over 12 years@jw013 No, it works, but is not the default. @Arcege is right:
/bin/sh
was notbash
in his Debian system, it wasdash
, the Debian Almquist Shell.