
Untitled
By: a guest on
May 14th, 2012 | syntax:
None | size: 0.82 KB | hits: 17 | expires: Never
#!/bin/bash
# Interactive wizard to walk the user through a process.
# Tracks steps completed; allows user to exit at any point and pick back up there.
function step1 () {
read -p "step 1 ok, $1? " ok
}
function step2 () {
read -p "step 2 ok, $1? " ok
}
function step3 () {
read -p "step 3 ok, $1? " ok
}
function step4 () {
read -p "step 4 ok, $1? " ok
}
function step5 () {
read -p "step 5 ok, $1? " ok
}
function step6 () {
read -p "step 6 ok, $1? " ok
}
function step7 () {
read -p "step 7 ok, $1? " ok
}
base=${0%.sh}
if [ ! -e $base.cfg ] ; then
# initialize the file with all the steps
echo -e "step1\nstep2\nstep3\nstep4\nstep5\nstep6\nstep7" > $base.cfg
fi
for x in `grep -v ^# $base.cfg` ; do
$x foo
# mark the step complete with a hash.
sed -i "s/$x/# $x/;" $base.cfg
done