Unix Comparison Operator

Comparison Operators String Comparison Description Str1 = Str2 Returns true if the strings are equal Str1 != Str2 Returns true if the strings are not equal -n Str1 Returns true if the string is not null -z Str1 Returns true if the string is null Numeric Comparison Description expr1 -eq…

grep Command

The grep Command The grep command searches a file or files for lines that have a certain pattern. Syntax Options Sr. No. Option & Description 1. -v (Prints all lines that do not match pattern.) 2. -n (Prints the matched line and its line number.) 3. -l (Prints only the…

Shell While Loops

While Loops The while loop enables you to execute a set of commands repeatedly until some condition occurs. It is usually used when you need to manipulate the value of a variable repeatedly. Syntax Scripts while.sh passwd.sh nameserver.sh