Changes

Jump to: navigation, search

Tutorial10: Shell Scripting - Part 1

No change in size, 10:24, 5 March 2021
INVESTIGATION 2: USING VARIABLES IN SHELL SCRIPTS
# Insert the following line at the '''beginning''' of the '''first''' line of your hello file:<br><span style="font-family:courier;font-weight:bold;">#!/bin/bash</span><br><br>This is referred to as a '''she-bang line'''. It forces this script to be run in the '''Bash Shell'''.<br>When your Bash Shell script finishes execution, you are returned to your current shell that you are using<br>(which in our case in Matrix, is still the Bash shell).<br><br>
# '''Save''' your editing changes and '''exit''' your text editor.<br><br>
# While in the Bourne shell, issue the following linux command:<br><span style="color:blue;font-weight:bold;font-family:courier;">./hello</span><br><br>You should notice that the shell name is running in the '''bashBash shell''' shell.<br><br>
# It is a good idea to rename your shell script to include an '''extension''' to<br>explain that this is '''Bash Shell script''' file (referred to as a "''portable Bash shell script''"). <br>Issue the following linux command to rename your shell script file:<br><span style="color:blue;font-weight:bold;font-family:courier;">mv hello hello.bash</span><br><br>
# Run your renamed shell script for confirmation by issuing:<br><span style="color:blue;font-weight:bold;font-family:courier;">./hello.bash</span><br><br>
13,420
edits

Navigation menu