8 views
#!/bin/bash
# (c) 2014 http://www.AskDevOps.org
# bash script -ne (linux bash -ne)
# Checks whether arithmetic expressions A and B are NOT equal.
A=10
B=11
if [ $A -ne $B ] ; then
    echo "$A and $B are NOT equal"
else
    echo "$A and $B are equal"
fi
# This outputs: "10 and 11 are NOT equal"

A=10
B=10
if [ $A -ne $B ] ; then
    echo "$A and $B are NOT equal"
else
    echo "$A and $B are equal"
fi
# This outputs: "10 and 10 are equal"

# One line example
test $A -ne $B && echo "$A and $B are NOT equal" || echo "$A and $B are equal"
# prefer the indented code until unless there is a real need for one liner
Oct 31, 2014 by | 8 views
Articles for DevOps Geeks
MobaXterm Customization
CHMOD Explained!
Bash history powerful tips
Ubuntu bash from Windows
..