actually, you can write in Bash (or any other shell) script, perl, awk, python, etc, etc...
instead of naming your script file with a ".BAT" extension (like you did in DOS/Windows), in Linux/Unix you just start the script with a comment that signifies the appropriate interpreter for the script that follows, i.e.:
#!/bin/bash ...or
#!/usr/bin/perl ...or
#!/usr/bin/python ...etc
...so then, an example bash script:
- Code: Select all
#!/bin/bash
# this line is a comment, like any other line beginning with a '#' symbol
#
# ...these, too!
ls -hort ~ # ...and, any character after the '#' on any given line is ignored by the interpreter, so you can 'document' your scripts
# this line, for instance, does a directory listing of the currently logged-in user's home directory, in human readable, long form, sorted in reverse chronological order
echo "all done!" # this will print 'all done!' on standard out at the conclusion of the script
# fini
when the editing is complete, just add the 'executable' bit to the script file you created by running "chmod +x <script_file_name>"
-- where <script_file_name> is replaced with the actual name of the script file you've created
...once you've finished your script, and you wish to make it available to others (or just have it handy for yourself), you can place it in /usr/local/bin (which is on the $PATH), and you can then invoke it by name from anywhere on the system.