Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
linux_essential [2017/04/19 08:38] – [Hello World in ''Bash''] adminlinux_essential [2017/04/19 08:52] (Version actuelle) – [File permissions] admin
Ligne 107: Ligne 107:
  
 **Hello world script** **Hello world script**
 +
 +We can run automatically the script without calling bash. 
 +The **#!** line tells the system to automatically run bash.
 +
 +<code bash>
 +$ nano hello.sh
 +</code>
 +
 +<code bash>
 +#!/bin/bash
 +
 +echo "hello world”
 +</code>
 + 
 +===== File permissions =====
 +
 +Files have properties:
 +
 +  * ''Read'', ''Write'', ''Execute''
 +  * Three different types of user: ''owner'', ''group'', ''everyone''
 +
 +
 +To take a script you have written and turn it into an executable program,
 +run “chmod +x” on it
 +
 +<code bash>
 +$ ls -al 
 +-rw-rw-r--   1 kmazouzi staff   33 avril 19 10:48 hello.sh
 +</code>
 +
 +<code bash>
 +
 +$ chmod +x hello.sh
 +
 +</code>
 +
 +<code bash>
 +$ ls -al 
 +-rwxrwxr-x   1 kmazouzi staff   33 avril 19 10:48 hello.sh
 +</code>
 +
 +**Execute the hello world script**
 +
 +<code bash>
 +$ ./hello.sh
 +
 +Hello World!
 +</code>
 +
  • linux_essential.1492591135.txt.gz
  • Dernière modification : 2017/04/19 08:38
  • de admin