Gitlab is now using https://gitlab.lcsb.uni.lu as it's primary address. Please update your bookmarks. FAQ.

Commit f707f5b9 authored by Christophe Trefois's avatar Christophe Trefois
Browse files

Bash part

parent 0046d2d0
......@@ -303,6 +303,39 @@ nano thisfile.txt
## Scripts - Running and Writing your own
***
Sometimes when you download and extract a zip file, it will contain not only files to look at, but also programs or scripts that you want to run.
Have a look at the contents extracted earlier and you will notice a file called `aprogram.sh`
* Run the program using `./aprogram.sh`
> This is a special syntax which tells the terminal to execute a program named `aprogram.sh` in the current folder rather than in the normal folders where all commands are. On Windows "Program Files" and *nix /usr/bin, /usr/sbin/ etc...
* Run the program again using `./aprogram.sh YourName`
* Look at the contents of the program using `nano`
## Create your first bash script!
* Create a new file called `myScript.sh`
> You can use touch and then nano, or you can use nano directly.
* Type in the following two lines
```bash
#!/bin/bash
echo "Hello World"
```
* Save and exit.
* Run the program using `./myScript.sh`
* ERROR. Why? We need to tell linux that a given file can be executed and therefore have to give the correct permissions to that file to transform it into a program that can be launched.
* To make our script executable do `chmod u+x myScript.sh`
* Launch our first script again
* Simple `bash` scripting [Tutotial](http://linuxconfig.org/bash-scripting-tutorial)
## Basic git (source control)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment