Bash scripts

Open the terminal.

mkdir bash-scripts
cd bash-scripts
nano  //open nano, and write this:
#!/bin/bash   //tells the system to use the bash program
echo here's my script //then Ctrl-X to exit nano.
chmod 755 //make the file executable
./ //runs the script
nano //open file and add more to the script:
//exit and run at any stage
echo Please enter your name
read NAME //stores user input in variable called NAME
echo "Hi $NAME!" //gets this variable by using $ //exit
echo //puts in a blank line
var1=Hello //sets a variable; note no spaces
echo $var1 $var2 //calls these variables
mydir=./R_files //the variable is that directory
echo $mydir
ls $mydir //lists the files in that directory
echo $1 $2 //these are cmd line args 1 and 2, entered after ./script
var4=$(ls) //var4 is the output of that command
echo The files in this directory are: $var4