Question
Why does the non-zero and the zero operator both return true in the shell script? This makes no sense. Please see the following small
Why does the non-zero and the zero operator both return true in the shell script? This makes no sense. Please see the following small script I have written. I set a variable 'zero' to have nothing. I also get the same results if I set 'zero' to "" or zero="" zero= #the below code prints "is not length zero" if [ -n $zero ] ; then echo "$zero is not length zero" ; fi #the below code prints if [ -z $zero ]; then " is length 0" echo "$zero is length 0"; fi
Step by Step Solution
3.49 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Chemistry A Molecular Approach
Authors: Nivaldo Tro
5th Edition
0134874374, 978-0134874371
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App