Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
#!/bin/bash
FILE="$1"
if [ $# -eq 0 ];
then
echo "Pass appropriate number of command line arguments"
fi
if [ ! -f "$FILE" ] && [ ! -d "$FILE" ] && [ ! $# -eq 0 ];
then
echo "Input file does not exist"
fi
if [ -d "$FILE" ];
then
echo "Input file is not an ordinary file"
fi
if [ ! -r "$FILE" ];
then
echo "Input file does not have read permission"
fi
if [ -f "$FILE" ] && [ -r "$FILE" ];
then
grep -cvP '\S' "$FILE"
fi
# Hello World Program in Bash Shell
foo=2
echo "Hello World!"
echo $foo
if [ "$foo" -ge 3 ]; then
echo "Greater than"
else
echo "Less than"
fi
first='Madhu'
lastname='Naidu'
middle='Naidu'
surname='Yanamala'
if [ $first=='Madhu' -a $lastname=='Naidu' ]; then
echo "First" $first
echo "Last" $lastname
else
echo $middle
fi
if [ $first=='Naidu' -o $lastname=='Yanamala' ]; then
echo "Second" $first
echo $lastname
else
echo "Else" $lastname
fi
if [ 'mad'='mad' ]; then
echo 'mad'
else
echo 'else mad'
fi
name=
if [ -z "$name" ]; then
echo "True empty"
fi
if [ "$first"='Madhu' ] && [ "$surname"=~"n" ]; then
echo "Surname" $surname
echo "First" $first
fi
if [[ "$middle" == "Naidu" && "$first"="Madhu" ]]; then
echo "And" $middle
else
echo "And false"
fi
if [ "$first"=="Madhu" ]; then
echo "True" $first
if [ "$surname"=="Yanamala" ]; then
echo "True" $surname
fi
fi
if [ "$first"="Madhu" ] && [ "$surname"="Yanamala" ]; then
echo "TRUE" $first $surname
fi