Showing posts with label shells. Show all posts
Showing posts with label shells. Show all posts

Wednesday, 3 October 2012

How to run MySQL query in a shell script

When you are writing a shell script as part of some batch processing, there are cases when the script needs to process data stored in a separate MySQL server. The general-purpose script languages such as Perl and Python have separate MySQL modules or interfaces to use, but shell script languages do not have such an interface for MySQL. However, there are ways to run some simple MySQL queries, and process the result even in a shell script.Read more »

Tuesday, 29 May 2012

How to set system-wide environment variables in Linux

In Linux, when a user logs in, login shell executes /etc/profile script. This script customizes environment variables system-widely for all users. Part of what /etc/profile script does is to source all .sh files placed in /etc/profile.d directory. Therefore, in order to set system-wide environment variables in Linux, you can create a custom file with .sh extension in /etc/profile.d as follows.Read more »