User Tools

Site Tools


writing_a_shell_script

This is an old revision of the document!


Writing a Shell Script



To successfully write a shell script, you have to do three things:


  1.Write a script
  2.Give the shell permission to execute it
  3.Put it somewhere the shell can find it


Writing A Script


A shell script is a file that contains ASCII text. To create a shell script, just use a text editor. Here is an example of a simple Shell Script:

  #!/bin/bash               # means comment
  # My first script         # any text after a # is ignored. So these first 2 lines do nothing.
  
  echo "Hello World!"


writing_a_shell_script.1470238803.txt.gz · Last modified: 2023/03/09 22:35 (external edit)