in Education by
In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2:-param2} These result is 0: not found and param=$5 S{1:-$param} is active. but $0 mean shell script name. I want to use number 0. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
echo "param: $param" # param is not defined echo "param: ${param-0}" # use 0 as default param=99 # set a value for param echo "param: ${param-0}" # ignore the default output: param: param: 0 param: 99

Related questions

0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I have the following cronjobs in my crontab: 0 22 * * 1-6 /root/sbin/mysqlbackup --conf-dir=/ ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I would like to get the exit code of my remote command. It's normally pretty easy, but I need ... -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@$ip_server bash...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    what is the difference between this two commands? sudo setfacl -R -m u:www-data:rwx -m u:yourname ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    what is the difference between this two commands? sudo setfacl -R -m u:www-data:rwx -m u:yourname ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    We have a script running to disable guest access. Will this new default setting overwrite our script?...
asked Mar 10, 2021 in Technology by JackTerrance
0 votes
    write a shell script to obtain any numbers of argument and print them in the reverse order? Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    write a shell script to generate all combination of 1 2 and 3 Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    write a shell script to generate all combination of 1 2 and 3 Select the correct answer from above options...
asked Dec 18, 2021 in Education by JackTerrance
0 votes
    I have a parameters.ini file, such as: [parameters.ini] database_user = user database_version = 20110611142248 I want to ... I do this? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    How can we pretty-print JSON in a shell script?...
asked Jan 11, 2021 in Technology by JackTerrance
0 votes
    In Intellij IDE's such as PyCharm or Idea there is an option to customize the menu and toolbar by ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I want to run a python script from a shell script. I have been able to run it from the "command ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 26, 2022 in Education by JackTerrance
0 votes
    I want to run a python script from a shell script. I have been able to run it from the "command ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
...