Answers for "bash open programm when exists"

1

bash open programm when exists

#! /bin/bash
array=("Google Chrome")
value=$@

if [[ " ${array[*]} " =~ " ${value} " ]]; then
    # open programm when in array / available
    open -a "${array[*]}"
fi

if [[ ! " ${array[*]} " =~ " ${value} " ]]; then
    # Can't find program
    echo "Programm not avalailable"
fi
Posted by: Guest on March-25-2022

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language