Linked Questions

229 votes
8 answers
202k views

I am writing my first shell script. In my script I would like to check if a certain command exists, and if not, install the executable. How would I check if this command exists? if # Check that ...
Andrew's user avatar
  • 241k
60 votes
7 answers
53k views

In a bash script, I need to determine whether an executable named foo is on the PATH.
Dónal's user avatar
  • 188k
66 votes
1 answer
61k views

I've read in some bash FAQ a while ago (that I don't remember), that which should be avoided and command -v preferred. Why is that so? What are the advantages, disadvantages of either one?
adrelanos's user avatar
  • 1,603
20 votes
2 answers
39k views

I need to check in a shell script if Docker is installed (Ubuntu server). I came up with this, but the syntax is not correct. if [[ which docker && docker --version ]]; then echo "Update ...
user3142695's user avatar
  • 17.5k
4 votes
1 answer
13k views

I am trying to create a little script that check if a program is installed or not. I am trying with tmux, ... `tmux --help` | grep "tmux: command not found" &> /dev/null if [ $? == 1 ]; then ...
sensorario's user avatar
  • 21.9k
0 votes
1 answer
5k views

I googled many solutions but did not find one that fully worked. My own rough working is: [ $(which curl) -eq "" ] || sudo apt install curl This doesn't quite work, saying "unary ...
YorSubs's user avatar
  • 4,228
0 votes
2 answers
5k views

I'm using Bash on OS X. There are several commands that I want to determine if exist, but don't want to run them in case they do exist and have unwanted effects. For example, if I wanted to test if ...
gkeenley's user avatar
  • 7,648
0 votes
1 answer
1k views

I want to check whether a program like firefox exists on ubuntu or not. In case it is not installed, I want to install it. I studied this topic and got information about command -v p programName, but ...
Pablo's user avatar
  • 535
1 vote
2 answers
168 views

The script is this #!/bin/bash echo echo "################################################################" echo " Installing Htop " ...
user avatar
2 votes
0 answers
224 views

I have a program called f in my $PATH, I can simply execute it by typing f into a terminal. However, typing which f into that same terminal afterwards, it errors out: which: no f in (...), and it ...
PhilippFrank's user avatar
0 votes
0 answers
98 views

I am writing an Script(BASH script), which uses dpkg, rpm, pacman commands, but at a time for a os one command is applicable, these command will run in different OS so for some os dpkg will pop up the ...
Arun Gupta's user avatar
1 vote
0 answers
92 views

I am trying to build a bash script which ultimately runs a docker container. I am running Ubuntu 20.04 LTS on a VM. Docker works perfectly and I can run the image I want to, but now I want to ...
mr_harm's user avatar
  • 61
0 votes
0 answers
62 views

I haven't done much bash scripting in the past (this is probably only my fourth or fifth script I have created). The current script i'm making will repeat a command (the script's argument) until it ...
Sol33t303's user avatar
  • 105
0 votes
0 answers
16 views

I've just noticed that when calling python from the command line, it just calls python from /usr/bin/python on account that it started v2.6: $ python Python 2.6.6 (r266:84292, Jun 11 2019, 11:01:44) ...
Maikol's user avatar
  • 357
1190 votes
12 answers
800k views

I'm studying the content of this preinst file that the script executes before that package is unpacked from its Debian archive (.deb) file. The script has the following code: #!/bin/bash set -e # ...
AndreaNobili's user avatar
  • 43.3k

15 30 50 per page
1
2 3 4 5
9