About 127,000 results
Open links in new tab
  1. if statement - How to use if elif else in bash - Stack Overflow

    Aug 2, 2021 · I cannot figure out how to use a simple if/elif/else structure in bash. I cannot believe how something as trivial as that can be so unintuitive and difficult. I've already spent quite a bit …

  2. How do I compare two string variables in an 'if' statement in Bash?

    If you are using Bash then include #!/bin/bash in the starting of the script and save your script as filename.bash. To execute, use bash filename.bash - then you have to use ==.

  3. if, elif, else statement issues in Bash - Stack Overflow

    Moreover if bash's specific or advanced features is not being used in the script then 'sh' should be used as the interpreter (one more reason for it) as it can handle the script by itself.

  4. bash - Using if elif fi in shell scripts - Stack Overflow

    Apr 27, 2017 · Quite a few commentators have suggested you use [ [ rather than [ but that makes your script bash-specific. You'll have fewer maintenance and portability issues if you can stick …

  5. bash - How to represent multiple conditions in a shell if statement ...

    Sep 30, 2010 · @Firelord: You'd need to separate the conditions into an if / else statement and have the code between then and fi put in a function in order to avoid repeating it. In very …

  6. What do the -n and -a options do in a bash if statement?

    The switches -a and -n are not strictly part of a bash if statement in that the if command does not process these switches. What are primaries? I call them "switches", but the bash …

  7. What command means "do nothing" in a conditional in Bash?

    Jul 11, 2013 · The question is tagged bash. In bash, true and false are built-ins. For older shells, true, false, and even : might be external commands (though you'd probably see the latter only …

  8. How to use if-else condition on gitlabci - Stack Overflow

    Reuse bash code in script for several jobs? Use bash functions? In GitLab CI/CD, I don't think there is a direct way to define rules once and reuse them across multiple jobs. However, you …

  9. What is the difference between single and double square brackets …

    Nov 24, 2012 · Ubuntu 16.04 actually has an executable for it at /usr/bin/[ provided by coreutils, but the bash built-in version takes precedence. Nothing is altered in the way that Bash parses …

  10. How to if/else statement in shell script - Stack Overflow

    Jan 7, 2014 · How to if/else statement in shell script Asked 13 years, 2 months ago Modified 1 year, 5 months ago Viewed 83k times