Saturday, April 15, 2017

Authenticate Alfresco Using POST method in shell script

#!/bin/bash






curl -X POST -H 'Content-Type:application/json' -d '{"username":"admin","password":"admin"}' http://192.168.1.4:8081/alfresco/s/api/login

Authenticate Alfresco Using shell script

#!/bin/bash


curl -X  GET 'http://192.168.1.4:8081/alfresco/s/api/login?u=admin&pw=admin'

Sunday, April 9, 2017

parse calendar shell script

#!/bin/sh
cal 2 1997
output=$(cal 2 1997);

while read line;do
echo "Printing Each Line";
echo "$line";
word=$(echo $line | tr " " "\n");
set $word;
echo "Printing Each Day In Row";
echo $1
echo $2
echo $3
echo $4
echo $5
echo $6
echo $7
done<<<"$output";

connect to RestAPI shell script

#!/bin/sh
curl -sb -H "Accept:application/json" http://www.thomas-bayer.com/sqlrest/CUSTOMER/3/

find list of firefox processes and terminate shell script


#!/bin/bash
output=$(ps -ef|grep firefox)
linesCount=0;
while read lines;do
((linesCount++));
echo "$lines";

word=$(echo $lines | tr " " "\n");
wordCount=0;
for wordArr in $word;do
((wordCount++));

if [ $wordCount -eq 2 ]
then
kill -9  $wordArr;
fi
done





done<<<"${output}"

Extract List of fileName from ls command shell script


#!/bin/bash
output=$(ls -l)
linesCount=0;
while read lines;do
((linesCount++));
if [ "$linesCount" -ne 1 ]
then

word=$(echo $lines | tr " " "\n");
wordCount=0;
for wordArr in $word;do
((wordCount++));
if [ $wordCount -eq 9 ]
then
echo $wordArr;
fi
done
fi





done<<<"${output}"

Count number of lines in a file shell script

#!/bin/bash



count=0;
while read lines;do
((count++));




done<"/home/rajam/name.txt"


echo "Number OfLines In a file";
echo "$count"