Archives for Scripting - Page 3
Beginner Shell Scripting Reference
I am sharing beginner shell script reference. Local Variable in Shell Script We can create local variables in shell script by using the keyword local. #!/bin/bash HELLO=Hello function helloWorld {…
Python Script to Access Team Foundation Server (TFS) Rest API
I was working in a project where I have to access Team Foundation Server (TFS) Rest API in Python script. It was little bit tricky job to access TFS REST…
Deleting Lines Containing Specific string from multiple files
Deleting Lines Containing Specific string from multiple files recursively Syntax: grep -Rl "STRING" /directory/path/ | xargs sed -i "/STRING/d" Example: Below example delete lines containing @license tag from src/main/php directory…
Get the List of All Files and Directory Recursively in Linux
List files and directories inside the specified path Some time we want to check list all files in a directory recursively. But its hard to navigate each and every directory…
Get File MIME Type in Python
Get file MIME type in Python You can get mime type in python by using python-magic library. You can install python-magic using PIP. $ pip install python-magic To find mime…
Rename all Files in the Directory
Here is the simple shell script to rename all files in the folder with increasing number. In below example I am going to rename all jpg image with increasing number.…
Run Mysql Query from Command Line
Shell script to run mysql query from command line without login into mysql command prompt. You can use these shell script for quickly execution of MySQL query from a Linux Shell. Method…
Start mysql server if not running
Here is the simple shell script to start the mysql service if the service is stopped. #!/bin/bash SERVICE='mysql' if ps ax | grep -v grep | grep $SERVICE > /dev/null…