Please tell me how to debug like the below statements in Unix.
How to understand what the below code is doing, step by step.
if [ ! -f $R_C_S_L/j_r_d* ]
then
echo 0>$R_C_S_L/j_r_d
fi
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well you read it just from left to right:
I guess
ifand[is clear?brings
man testup, and there we read:and further down:
which file?
is parsed from left, where $ indicates, it is a variable. From writing variables myself, and glueing them together, I know, that it will include only the L, so $R_C_S_L is a variable, then / is the directory delimiter, and j_r_d* is part of a name, with a globbing pattern.
So a directory, referenced by $R_C_S_L, with a file, matching j_r_d* is searched, that’s the test, and ! is the negation, so if the test fails, the inner part is done.
writes a 0 to the shortest file, matching above pattern, if no such file exists.