JPEG images to PNG images, where the image names are provided on the command-line—possibly via wildcards—instead of each being listed within the script, can be created with this file, typically saved in a file like /home/username/bin/jpg2png #!/bin/sh for jpg; do # use $jpg in place of each filename given, in turn png=${jpg%.jpg}.png # construct the PNG version of the filename by replacing .jpg with .png printf 'converting "%s" ...\n' "$jpg" # output status info to the user running the script if convert "$jpg" jpg.to.png; then # use convert (provided by ImageMagick) to create the PNG in a temp file mv jpg.to.png "$png" # if it worked, rename the temporary PNG image to the correct name else # ...otherwise complain and exit from the script printf >&2 'jpg2png: error: failed output saved in "jpg.to.png".\n' exit 1 fi # the end of the "if" test construct done # the end of the "for" loop printf 'all conversions successful\n' # tell the user the good news The jpg2png command can then be run on an entire directory full of JPEG images with just /home/username/bin/jpg2png *.jpg Programming Many modern shells also supply various features usually found only in more sophisticated general-purpose programming languages, such as control-flow constructs, variables, comments, arrays, subroutines and so on. With these sorts of features available, it is possible to write reasonably sophisticated applications as shell scripts. However, they are still limited by the fact that most shell languages have little or no support for data typing systems, classes, threading, complex math, and other common full language features, and are also generally much slower than compiled code or interpreted languages written with speed as a performance goal. The standard Unix tools sed and awk provide extra capabilities for shell programming; Perl can also be embedded in shell scripts as can other scripting languages like Tcl. Perl and Tcl come with graphics toolkits as well. Typical POSIX scripting languages Scripting languages commonly found on UNIX, Linux, and POSIX-compliant operating system installations include: KornShell (ksh) in several possible versions such as ksh88, Korn Shell '93 and others. The Bourne shell (sh), one of the oldest shells still common in use The C shell (csh) GNU Bash (bash) tclsh, a shell which is a main component of the Tcl/Tk programming language. The wish is a GUI-based Tcl/Tk shell. The C and Tcl shells have syntax quite similar to that of said programming languages,