Ask coding questions

← Back to all posts
How do I install linux utilities?
erelsgl (0)

In my grading script "grade", I calculate the grade using the "bc" linux command:

 average_grade=$(echo "scale=1;(${grades[*]})/${#grades[@]}"|bc)

But when I run it, I get an error message saying that "bc" is not installed. How can I install it on my repl?

Comments
hotnewtop
Wumi4 (486)

Use pkg-install.

# This will install the utility `tree`
# to your Repl
pkg-install tree
erelsgl (0)

@Wumi4 This does not work:

~/grade$ pkg-install bc
bash: pkg-install: command not found
~/grade$ sudo apt install bc
bash: sudo: command not found
~/grade$ apt install bc
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
Wumi4 (486)

@erelsgl Oh, you need to switch your Repl language to another language, like Python. I forgot to mention about it.

erelsgl (0)

@Wumi4 How do I do this? In the .replit file I changed to language = "python" but I still get the same error.

Wumi4 (486)

@erelsgl Umm... Create a new Python Repl?