resolve bin sh resource not found

How to Resolve bin/sh: 1: source not: found

Ubuntu is a popular Linux system used by millions of users. It allows you to automate tasks and processes by creating and running shell scripts. But sometimes while running shell scripts in Ubuntu, you may get an error saying “bin/sh: 1: source not: found”. In this article, we will learn how to resolve bin/sh: 1: source not: found error message.

Typically, bin/sh is used to run a shell script using sh, Bourne shell or another shell.


How to Resolve bin/sh: 1: source not: found

In Linux, the source command is used to read and execute the contents of a file passed as a command line argument.

When you use fpyll repository, you may get error “bin/sh: 1: source not: found” if you start activating using the following command.

$ source ./activate
/ bin / sh: 1: source: not found

One of the most common reasons why you get this error is because the source is not sh built-in but another shell such as bash. So you can resolve this problem by switching to bash instead of sh. For this, use . ./activate instead of source ./activate.

$ . ./activate

Another reason why people get this error is when they use automated shell scripts to update /etc/profile and $HOME/.profile and some of the paths mentioned in them aren’t exported. Now when you automatically reload these files with the following commands

$ source /etc/profile
$ source ~/.profile

you will get the error.

source: not found

The above message does not mean that the source itself is not found but that the source is a bash built-in while the script isn’t run with bash. In this case, replace source command with dot(.).

$ . filename
Instead of using the below command:

$ source filename

Basically, /bin/sh is a shell that imitates The Bourne Shell. Many Ubuntu distributions use /bin/bash (bash shell) instead which supports source command. However, if your Ubuntu distribution used /bin/dash instead then you may get this error.

To sum up, we get this error when we use source command to read & execute the contents of a file in Linux shell. This is because the source command is meant to run in a specific shell while the file (used as argument) is meant to be run in another incompatible shell. So the solution is to either change your shell script to run in a shell that is compatible with source command, or use an alternative to source command such as dot(.).

Also read:

How to Reload /etc/hosts in Linux
How to Kill Stopped Jobs in Linux
How to Change MAC Address in Linux
How to Convert Permissions to Octal in Linux
How to Compare Local & Remote Files in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *