New Script files

This commit is contained in:
Ravi
2018-06-20 15:37:36 +05:30
parent 909a5569d5
commit 36fe0b1ee4
10 changed files with 169 additions and 0 deletions

17
add.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "addition of X+Y"
echo "Enter X"
read X
echo "Enter Y"
read Y
echo "X+Y = $X+$Y = $[ X+Y ]"
# END #

20
agtb.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "enter the a vloue $a"
read a
echo "enter the b volue $b"
read b
if test "$a" -gt "$b" ; then
echo "$a is greater than $b"
else
echo "$b is greater than $a"
fi
# END #

15
details.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "WEL COME TO $USER"
echo "Your present working directory is `pwd`"
echo "current logged in users are `who`"
echo "Today date is `date`"
# END #

13
echo.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "current location files are `ls`"
echo "current working directory is `pwd`"
# END #

22
hi.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
tmp=`date | cut -c12-13`
if [ $tmp -lt 11 ] ; then
echo "Good Mornind have a nice day $USER"
elif [ $tmp -gt 11 -a $tmp -lt 16 ] ; then
echo "Good Ofter noon $USER"
elif [ $tmp -gt 15 -a $tmp -lt 19 ] ; then
echo "Good Evening $USER"
else
echo "Good Night Sweet dreams $USER"
fi
echo "Now the time is `date |cut -c12-19`"
# END #

17
info.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "Hi you there"
echo "what is your name? (Type your name here and press Enter)"
read NM
echo "Hi $NM Good Morning"
echo "your currently logged in as $USER"
echo "your present working directory is `pwd`"
# END #

17
multiplication.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "multification of X*Y"
echo "Enter X"
read X
echo "Enter Y"
read Y
echo "X*Y = $X*$Y = $[ X*Y ]"
# END #

14
uadd.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "ecnter the user name $NM"
read NM
echo "`useradd -d /users/$NM $NM`"
# END #

16
ud.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
#Purpose: eval command Evaluating twice
#Version:1.0
#Created Date: Wed Jun 13 22:09:59 IST 2018
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
echo "WEl COME TO $USER"
echo " Your present Wroking Directory is `pwd`"
echo "Present Processes are `ps -a`"
echo "Now Time is `date`"
echo "current logged in Details are `finger $USER`"
# END #

18
useradd.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Script to add a user to Linux system
if [ $(id -u) -eq 0 ]; then
read -p "Enter username : " username
read -s -p "Enter password : " password
egrep "^$username" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo "$username exists!"
exit 1
else
pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
useradd -m -p $pass $username
[ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
fi
else
echo "Only root may add a user to the system"
exit 2
fi