Hi hypogogix and welcome to LQ.
$1, $2, and so forth are passing arguments to the script, and this is the standard convention used to indicate those arguments. When you call your script, say it is called test.sh, if you type, "./test.sh this that", the string this is in the variable $1 and the string that is in the variable $2. So if you want to give the name for a process, such as cruncher, you would give that as an argument to your script, therefore allowing you to change that name without changing your script.
You would probably use the first argument $1 to get the pid of cruncher. "pidof $1" where cruncher was your first passing argument.
Similarly, you can choose a level of nice as your second argument, $2.
Here are some links to review to understand how to use bash scripting, the beginners guide will be very helpful:
Bash Guide for Beginners
Advanced Bash Scripting Guide
Also, here is a Bash guide I wrote to help bash programmers with debugging their scripts:
Bash Scripting for Dummies and Geniuses
For when you post any additional code clips, it is helpful to use
[code][/code] tags around your code, or in Advanced Edit mode, to use the
# tool to do this same action. This will both identify your code, as in the example below, and also maintain formatting of the code.
Code:
#!/bin/bash
set -xv
echo "This is a simple bash programming example