V
V
Viktor Taran2019-03-11 17:32:22
bash
Viktor Taran, 2019-03-11 17:32:22

If there is no argument on the input, how to substitute the default value?

There is a certain skrkit that eats $1
scrypt.sh site.ru
How to track the absence of an argument event and substitute $DEFAULT

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drill, 2019-03-11
@shambler81

DEFAULT="site.ru"
if [ -z "$1" ]
   then
   site=$DEFAULT
else
   site=$1
fi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question