mercredi 12 juin 2019

Bash detect 1st input parameter is "debug"?

I want to detect if the 1st bash input parameter is "debug"(string).

I write script like this:

#! /usr/bin/env bash

if [ "$#" -eq "1" && "$1" -eq "debug" ]; then
    echo "hello debug"
fi

Error message:

line 3: [: missing `]'

I don't know why, please help.

Aucun commentaire:

Enregistrer un commentaire