Tag Archives: bash

Kids at Play at BASH in Paarl (2017-10-08) Kid Activities | Photo Gallery 08 JUN 2018

Kids’ birthday party venues are always an exciting find when you are a parent who a) doesn’t have access to a big house, b) don’t want to spend an entire day cleaning up the mess created by hosting such a party in their own space, or c) don’t feel like the effort of setting one up in the first place!

Based in Rosendal (a suburb of Bellville), and operating since November 2016, BASH had been an exciting addition to the Northern Suburbs’ childrens party scene for a while now, so much so that business boomed and the need for a second venue quickly became a reality – and so in October of last year their new baby BASH Paarl was born.

Situated on the Dvine Events’ grounds and primarily a birthday party venue, BASH hosts all manner of kids birthday parties, with the focus being mainly on activity based parties. Thanks to their signature Master Mini Chef Cooking Kitchen there are the super popular Baking and Cooking party options available, and thanks to the Private Craft Room, Wooden Craft parties, Canvas Painting parties, Flower Arrangement parties, and even Beading Parties are also all on the cards. Oh, and then there are the actual Pamper party sessions – seriously, which little girl is not going to love any one of these ideas!

Plus, BASH has filled their 200m2 hall, with a host of wooden play structures and toys, from a giant jungle gym right through to a pretend party bus. This, combined with the massive lawn and outside play area means that they are just perfectly suited for more action packed activity play parties as well. (Thank goodness, something for the boys!)

In addition to all the birthday party stuff, BASH is also open to the general public (you pay to play), and thanks to their small deli and restaurant option, the adults stay fed and able to enjoy the gorgeous views of the Paarl mountains while the little ones run themselves ragged.

Basically, what’s not to love about that?

Now Chantelle had been following BASH via Facebook for quite some time, eagerly following their setup progress – meaning that by the time they finally launched in October last year, I simply had no other choice but to bundle everyone in the car and make the long drive through to Paarl. Not that I minded though – the girls had an absolute blast and I thought the location was stunning.

In other words, hard not to admit defeat and pat my wife on the back for discovering such a fun venue.

NOTE: Of course, visiting a venue on their day of opening is almost also never a great idea because the chance to first get processes, procedures and numbers in place (and running smoothly) is obviously not yet there, so naturally our visit did come with a few of those very challenges attached (for example, the restaurant was to busy in order to serve us). That said, it has been a good few months since our visit and quite frankly, both Chantelle and the girls are rather itching for a return trip.

I guess we’re heading back to Paarl sooner than later then! ;)

Related Link: BASH | Paarl

Ubuntu Terminal: How to set a User’s Shell to Bash Tips, Tricks and Tutorials 19 AUG 2013

ubuntu-10-logoGiven an installation of Ubuntu Server (or pretty much any other Linux variant that requires you to use a terminal), changing a user’s shell is thankfully pretty easy.

I generally like to use bash as my shell of choice, as it gives me the most user friendly and verbose interface to work in, meaning that I often find myself having to switch a newly installed system’s default out for bash for my freshly added user account.

And given that this post is more a reference for me than anything else, these are a useful set of steps to follow in order to change to Bash:

1. Check the user’s current shell by reading the entry in the /etc/passwd user information file.

grep craig /etc/passwd

Grep will return something that looks like craig:x:1006:1006::/home/craig:/bin/sh. That particular line tells us that the system is currently using sh as my shell.

2. Grab a list of available shells by reading the common /etc/shells file.

cat /etc/shells

3. Change the shell using the chsh command. If you are logged into your account, then chsh will first prompt you for your password, followed by a prompt for the new shell. Note, you have to enter the full path, as listed in /etc/shells.

Oh, you can also quicken the process by calling chsh with parameters, as indicated by the man page:

chsh -s /bin/bash craig


Ubuntu: How to count the number of Files in a Directory via the Terminal CodeUnit 18 JUL 2011

In order to count the number of files in a directory or folder in Ubuntu via the terminal, it is a simple matter of using the ls listing command with a numeric 1 switch and then piping its result to the line count function wc. In practice, this would retrieve the number of files in the current working directory (non recursive):

ls -1 | wc -l

If you say need a recursive count of all the files under the current working directory, simply run:

find . -type f | wc -l


Ubuntu: Get Yesterday’s Date for a Bash Script CodeUnit 10 JAN 2011

Date work often plays an important part in automated bash scripts, and as such, it is pretty useful to be able to calculate yesterday’s date for your variable work.

Now we know in order to get the current date we could use this:

NOW="$(date +"%Y/%m/%d")"

Using this info, we find that it is remarkably simple to get yesterday’s date on any Linux system with:

YESTERDAY="$(date -d 'yesterday' +%Y/%m/%d)"

There are a range of other date manipulating strings available, including things like “3 days ago”, “next Monday”, “2 months”, etc, most of which can be found on the info date entry.


Ubuntu: The Basics of Bash Scripting CodeUnit 03 JAN 2011

A bash script is simply put a file containing a list of commands to be executed by the bash shell (remember, there are a number of different shells available in the Unix world).

The very simplest scripts contain a set of commands that you would normally enter from the keyboard. For example:

#! /bin/bash
# script to turn the screen blue
setterm -background blue
echo Yes, your background is now Blue

Line 1: specifies which shell should be used to interpret the commands in the script (also known as a shebang).
Line 2: is a comment (has no effect when the script is executed).
Line 3: sets the background colour.
Line 4: displays a message.

To run the script:

Make the script executable: chmod 700 mySimpleScript
Try to run the script by typing the command: mySimpleScript

You will get the error message: command not found

Remember, a linux system will only only look for commands or scripts in the directories in your search path. So the system looks for the “mySimpleScript” command in the directories /usr/bin and /bin, doesn’t find it and returns the error message.

Run the script with the command:
./mySimpleScript – which means: run mySimpleScript from the current directory

If you are getting error messages when you run the script, you can trace the lines as they execute using the command: bash -v mySimpleScript

As the script executes, each line is displayed on the screen so that you know exactly what your script is doing.

Now let us expand a bit by using variables in our script.

Variables are created when you assign a value to them ( eg: COLOR=blue ). To use the variable, put a $ before the variable name. ( eg: echo $COLOR ). Modify the mySimpleScript script to use the color variable as follows:

#! /bin/bash
setterm -background $COLOR
echo It is a $COLOR day

Test it out. Next, a script can get input from the user while it is running. Use the echo command to display a prompt on the screen and the read command to get the input.

#! /bin/bash
echo -n "Pick a screen color (blue, yellow, red ): "
read -e COLOR
setterm -background $COLOR
echo It is a $COLOR day

And lastly. You can also pass parameters to the script on the command line. Bash will accept up to 9 parameters separated by spaces. The first parameter is $1, the second parameter is $2, etc. The mySimpleScript script using input parameters is shown below.

#! /bin/bash 
setterm -background $1 
echo It is a $1 day

To run the script, use the command: mySimpleScript red

In this case, $1 will be given the value “red”.

Run the script again using the command: mySimpleScript blue

This time, $1 will have the value “blue”.

And there you go. You should now have enough information in your arsenal to get started generating all your own wonderful bash scripts!

Needless to say, nifty.

(Note: Post pretty much lifted from here, mainly to save it for my personal reference. Just in case you wanted to raise a stink about it.)

A Quick Guide to Bash Shell Scripting CodeUnit 23 AUG 2010

I stumbled across this gem of a quick guide to Bash shell scripting over at some or other forum and so as not to lose this valuable resource for my later use, I’ve decided to duplicate it here and thus save it for prosperity.

Common environment variables

PATH – Sets the search path for any executable command. Similar to the PATH variable in MSDOS.

HOME – Home directory of the user.

MAIL – Contains the path to the location where mail addressed to the user is stored.

IFS – Contains a string of characters which are used as word seperators in the command line. The string normally consists of the space, tab and the newline characters. To see them you will have to do an octal dump as follows:

$ echo $IFS | od -bc

PS1 and PS2 – Primary and secondary prompts in bash. PS1 is set to $ by default and PS2 is set to ‘>’ . To see the secondary prompt, just run the command :

$ ls |

… and press enter.

USER – User login name.

TERM – indicates the terminal type being used. This should be set correctly for editors like Vim to work correctly.

SHELL – Determines the type of shell that the user sees on logging in.

Note: To see what are the values held by the above environment variables, just do an echo of the name of the variable preceeded with a $. For example, if I do the following:

$ echo $USER

… I get the value stored in the environment variable USER.

Continue reading

Ubuntu: A Bash Script to Backup All MySQL Databases Running on a Server CodeUnit 28 JUL 2010

The following bash script is written to automate the process of backing up all your various MySQL databases running on either a local or remote MySQL server, using the useful mysqldump utility to do the actual backups.

What the script does is pretty simple to understand really.

First, you define all your server connections. Then it queries the server to find out which databases are currently running in the MySQL Server instance. Armed with this list, it runs through them all (ignoring the ones you specified on the ignore list) and pulls down a mysqldump of each database, gzipping it to its final backup file name.

Simple eh? So let’s see it then:


# Linux bin paths, change this if it can't be autodetected via which command
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
CHOWN="$(which chown)"
CHMOD="$(which chmod)"
GZIP="$(which gzip)"

# Backup Dest directory, change this if you have someother location

# Main directory where backup will be stored

# Get hostname

# Get data in dd-mm-yyyy format
NOW="$(date +"%Y%m%d-%H%M%S")"

# File to store current backup file

# Store list of databases

# DO NOT BACKUP these databases

[ ! -d $MBD ] && mkdir -p $MBD || :
# Get all database list first
DBS="$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse 'show databases')"

echo "Launching backup script at $(date)"

for db in $DBS
    if [ "$IGGY" != "" ];    then
        for i in $IGGY        do
            [ "$db" == "$i" ] && skipdb=1 || :

    if [ "$skipdb" == "-1" ] ; then
        # do all inone job in pipe,
        # connect to mysql using mysqldump for select mysql database
        # and pipe it out to gz file in backup dir
	echo "Starting backup process for $db (espreports.com) [$(date)]"
	$MYSQLDUMP --opt --compress --single-transaction -u $MyUSER -h $MyHOST -p$MyPASS $db | $GZIP -9 > $FILE
	echo "-- Complete ($FILE) [$(date)] --"

echo "Backup script completed execution at $(date)"

And we’re done. Nifty. (And damn useful to boot!)