unix - Nested if in shell scripting -
I want to write a script that takes 1 command line agreement (a directory) and then points to 2 numbers , Then print any file (each on a separate line), which is the size between that number, this is my script
echo -n "Enter the first number:" an echo -N Read "Second, enter a larger number:" If read, [$ b -lt $ a] then resonates' first number Should Ota In 'else files $ $ echo $ 1 Echo following $ a and $ b bytes' Ls $ 1' if [-f $ var] If size = 'ls -l $ var |' '{Print $ 5}' 'If [$ size -l $ b & amp; $ Size -ge $ a] Then resonance is $ var $ size bytes fix The problem is that after I enter the numbers, it will print "files ..." and then some And no, besides, I use V to edit it, but the color of the last three rows is not quite right (the color should match the "fi" first but this is not). Can anyone show me what was wrong? Thank you.
Your immediate problem is that you used single quotes, however where you wanted the command replacement This is the wrong way to recycle files. You should use pattern matching instead. For $ 1 / *, you should read your loop , if [-f "$ var"] then check the 'man stat' for the # right value string If your system size = $ (state +% s "$ var") on [$ size -l $ b] & amp; Amp; [$ Size -ge $ a] then resize $ var $ size bytes
Comments
Post a Comment