From MEPIS Documentation Wiki

Jump to: navigation, search

A script is an interpreted program that can be written directly from a keyboard. The default script interpreter in MEPIS is Bash. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. A shell script is the Linux counterpart of batch programs in the Windows world.

How to write a bash script

  1. Edit a file with any text editor. KWrite is the default choice for a GUI text editor, for console based text editor you can use nano.
  2. Add #!/bin/bash line at the top of the file
  3. Add the rest of the commands and save the file
  4. Make the file executable (see below)

How to execute a script

  1. You need to make sure that the script is executable, from console execute a command like "chmod +x scriptname" or using GUI: in File manager right-click on the file -> Properties -> Permission tab -> Select checkbox "Is executable" -> OK
  2. Run the script by specifying the full path, e.g., /home/user/scriptname as an alternative you can use the more convenient format ./scriptname but only if the current directory is the directory in which the script is located, "./" being a shortcut for "current directory".


See also Bash commands and Bash.

Personal tools
In other languages