IF-ELSE
if [ "$value" -eq "0" ] || [
"$value" -ge "2" ]; then
echo "condition met"
else
echo "condition not met"
fi
Comparisons:
-eq
|
equal
to
|
-ne
|
not
equal to
|
-lt
|
less
than
|
-le
|
less
than or equal to
|
-gt
|
greater
than
|
-ge
|
greater
than or equal to
|
Exit Host concurrent program with
Error
exit 2;
Linux Find and Move Archive
files older than N days
find $frompath -type f -mtime +$age -exec mv {} $archive \;
Obtain value from string
echo $value | cut -f1 -d"."
Command will return the value
starting to until “.” is found.
Test.txt will return Test
Using SUBSTR in Unix
echo $name | awk '{ print substr( $0, 0, length($0)-4 ) }'
Command will return name starting
from 0 to (lengthofstring)-4
Test.txt will return Test