14

I had this script:

spd-say "Hello, don't forget the trash bin."

So it reminded me of what I supposed to do, and I moved it to /usr/local/bin/ and the command trash pronounced the argument,then I set a crontab job, to make it remind me everyday what I wanted to do. But the crontab didn't work and I couldn't understand why(It does other jobs flawlessly).

Once I saw this message in my terminal:

You have new mail in /var/mail/root

at the end of which this line made me do a bad mistake:

/bin/sh: 1: trash: not found

I know that it was a silly thing to do but I did:

mv /usr/local/bin/trash /bin/sh

thinking that sh is a directory and I should move the script there in order to be executed.

Now, when I want to see a man page the system says:

"Hello, don't forget the trash bin."

And the output of cat sh is:

#!/bin/bash
spd-say "Hello, don't forget the trash bin. "

Anyway, can I do anything or I have to reinstall my operating system?

2 Answers2

30

In Ubuntu systems, /bin/sh is a symbolic link to the dash shell by default:

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jul  7  2018 /bin/sh -> dash

So (assuming your terminal emulator uses the bash shell, and didn't get broken by your mistake) all you need to do is re-create the link:

sudo ln -sf dash /bin/sh
steeldriver
  • 142,475
7

No, you don't have to reinstall your system. /bin/sh is only a softlink to your shell. readlink -f /bin/sh /bin/bash In my case bash. Move your script and make a softlink to your favorite shell.

wjandrea
  • 14,504
nobody
  • 5,792