Friday, 30 August 2019
Thursday, 29 August 2019
Copying file from One directory to Another in Unix
copy_file{
for file in \MyDrive\MyFolder\
do
echo $file
FILESIZE=$(stat -c%s $file)
echo "filesize " $FILESIZE
if [[ "$FILESIZE" -eq 0 ]]
then
echo "$file is empty.Hence not sending it.Can't Execute further"
exit 1
else
echo "$FILE has data."
fi
echo "Copying File "
cp $file $Other_Directory
}
#************Starting Copy File String#
copy_file
for file in \MyDrive\MyFolder\
do
echo $file
FILESIZE=$(stat -c%s $file)
echo "filesize " $FILESIZE
if [[ "$FILESIZE" -eq 0 ]]
then
echo "$file is empty.Hence not sending it.Can't Execute further"
exit 1
else
echo "$FILE has data."
fi
echo "Copying File "
cp $file $Other_Directory
}
#************Starting Copy File String#
copy_file
Find list of file names containing particular text
To find list of file names containing a particular text
$ grep -H -r "Findthis word" Your_path
FTP using Unix Shell Scripting
For doing FTP what u need in unix is Username and password and server path where you are transferring file.
send_viaftp(){
ftp -ni $destination
verbose
user $username $password
cd $destinationfolder
ascii
put $myfile
}
#Copying file to server2
send_viaftp
send_viaftp(){
ftp -ni $destination
verbose
user $username $password
cd $destinationfolder
ascii
put $myfile
}
#Copying file to server2
destination=server2
destinationfolder=home/test
username=test
password=tst$888
send_viaftp
Thursday, 22 August 2019
Getting started with Unix
chmod +x test.sh
this is the command used to make file executable
To execute File
./test.sh
Date used to get date
date
Creat a file
vi hello.sh
inser code
esc + I
Save code and quit
esc + :wq
if file is readonly use
:wq!
Give access to execute
chmod +x hello.sh or chmod 755 hello.sh
Execute Script
./Hello.sh
See what is the content of this file
cat Hello.sh
Exporting values in Unix for Variables
I have a script
echo " VAR VALUE IS $VAR1"
$VAR1="hello"
echo"NEW VAR VALUE IS $VAR1"
output
run using ./hello.sh
Var value is
New var value is hello
if you define $VAR in command prompt before running
$VAR = OLDHELLOW
It wont recognize this running ./hello and out put will be same
To make it global we need to export this value using
export VAR
Location for Java on Unix is
/usr/local/<java_Install>
To remove file preds.jar
rm preds.jar
To view Contents of Jar file
jar tvf Name_Of_JarFile
this is the command used to make file executable
To execute File
./test.sh
Date used to get date
date
Creat a file
vi hello.sh
inser code
esc + I
Save code and quit
esc + :wq
if file is readonly use
:wq!
Give access to execute
chmod +x hello.sh or chmod 755 hello.sh
Execute Script
./Hello.sh
See what is the content of this file
cat Hello.sh
Exporting values in Unix for Variables
I have a script
echo " VAR VALUE IS $VAR1"
$VAR1="hello"
echo"NEW VAR VALUE IS $VAR1"
output
run using ./hello.sh
Var value is
New var value is hello
if you define $VAR in command prompt before running
$VAR = OLDHELLOW
It wont recognize this running ./hello and out put will be same
run using ./hello.sh
Var value is
New var value is hello
To make it global we need to export this value using
export VAR
run using ./hello.sh
Var value is oldhello
New var value is hello
But in our interactive shell the value will still be old hello even though we assign it hello.
To know your current location use
pwd
command.
To know your current location use
pwd
command.
Location for Java on Unix is
/usr/local/<java_Install>
To remove file preds.jar
rm preds.jar
To view Contents of Jar file
jar tvf Name_Of_JarFile
Wednesday, 21 August 2019
Spring MVC 100 top Questions
1. What is Spring MVC?
2. Why to use Spring MVC?
3. What is Dispatcher servlet?
4. What is Spring MVC Workflow?
2. Why to use Spring MVC?
3. What is Dispatcher servlet?
4. What is Spring MVC Workflow?
Monday, 5 August 2019
Subscribe to:
Comments (Atom)