Create a script for PlayOnLinux - Chapter 1: Become familiar with the bash

Introduction

You would like to create your scripts for PlayOnLinux, but you are a noob in programming? This tutorial will explain it to you very simply and you will become a professional of the playonlinuxian bash very quickly

The bash?

Bash is an interpretor of commands under GNU/Linux. It's the one which appears when you open a terminal. It also allows to make scripts. A script is a list of commands that your console will run one after another

PlayOnLinux has advanced functions in bash designed to simplify the scripting. We will discover them

Your first script

For scripting, I recommand you to use Zoloom's program: PlayOnLinux-Script-Creator. Otherwise, a simple text editor is enough.

We said that PlayOnLinux was made in bash. Open your text editor, and type the following line:

#!/bin/bash

then, you have to add a piece of code allowing to load PlayOnLinux's functions

if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi

source "$PLAYONLINUX/lib/sources"

This code isn't always clear at the first glance. You will understand it in the next chapter

In this tutorial, I won't write this piece of code in each example, since it's necessary. Remind to include it or your script won't work.

Run your script

Note: I strongly advise you to work with a console. It's a priceless tool in case of problems. For that purpose, just run "playonlinux" or "playonlinux-script-creator" in a console. The possible errors will be described inside.

With an unspecified text editor, save your script and use the "Run" function, in the "Tools" PlayonLinux's menu

With PlayOnLinux-Script-Creator, use the "Run" button

Nothing happens? It's normal, you didn't ask anything to PlayOnLinux for the moment.