Answer the question
In order to leave comments, you need to log in
Script with a condition, how to write it correctly?
a script that, depending on the passed value, does one of the actions.
tried like this, didn't work.. newbie in bash
#!/bin/bash
value=$1
if "$value" = "one"; then
#действие 1
else
#действие 2
fi
Answer the question
In order to leave comments, you need to log in
#!/usr/bin/env bash
value=$1
if [ "$value" = "one" ]; then
echo "one!"
else
echo "not one!"
fi
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question