Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/bin/bash: command not found Google Colab

I am trying to run a ready project on Google Colab.. when I run a shell it gives the following error:

/bin/bash: example.sh: command not found

How I can solve this problem?

like image 554
userInThisWorld Avatar asked May 12 '26 12:05

userInThisWorld


1 Answers

You have two options to run shell script in google-colab:

1) Execute a single script with !:

!sh example.sh
!echo "I am your code !!!" 

2) Execute entire code-block as shell script with %%shell:

%%shell
sh example.sh
echo "You should add %% "

Note: In the second approach, entire block interpreted as shell script. You do not need ! at beginning of every script.

like image 160
Amir Avatar answered May 17 '26 12:05

Amir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!