Hi,
I would like to write a script with include more than 6 unix commands.
my script like below:
echo " script started"
ls -ld
bdf | grep "rama"
tail -10 log.txt
...
..
...
now, i want to run above unix commands one by one.
example:
first the ls -ld command will be executed, then the script will wait for user input( ENTER from KEYBOARD) to continue for execute next command(bdf | grep "rama")
#! /bin/bash
function continue ()
{
echo -n "Continue? "
read KEY
}
echo "1st command"
continue
echo "2nd command"
continue
echo "3rd command"
exit 0
koti_rama:
Hi,
I would like to write a script with include more than 6 unix commands.
my script like below:
echo " script started"
ls -ld
bdf | grep "rama"
tail -10 log.txt
...
..
...
now, i want to run above unix commands one by one.
example:
first the ls -ld command will be executed, then the script will wait for user input( ENTER from KEYBOARD) to continue for execute next command(bdf | grep "rama")
After each command, give one more command as "read".
So it will wait for ur enter.
eg.
echo " script started"
read;
ls -ld
read;
bdf | grep "rama"
read;
tail -10 log.txt
read;
Lakris
February 9, 2010, 7:31am
4
Hi,
one simple way is to use the read command, ie
...
ls -ld
read input
bdf | grep "rama"
...
whatever the user enter is put into the variable input, which You can use or discard as You please.
Best regards,
Lakris