I need to know how to write a script that will tell me: every second the script is executing the script has to display the number of seconds that it has been executing. Then as the count gets to 10 it must exit
On Wed, 26 Sep 2007, jalal.hajigholamali via shellscript-l wrote:
#!/bin/sh
while [ “$INPUT” != “exit” ]
You should initialize INPUT in case it has previously been set to
“exit”.
do
read -p "Please Enter Directory Name: " INPUT
$ read -p "Please Enter Directory Name: " INPUT
ksh: read: no query process
The -p option is not standard.
if [ “$INPUT” != “exit” ]
then
if [ -d $INPUT ]
That will fail if $INPUT contains a space or other pathological
character. Quote the variable:
if [ -d “$INPUT” ]
then
ls $INPUT
See previous comment.
else
echo “$INPUT Is Not A Directory or unreadable”
fi
fi
echo $HOME
done
–
Chris F.A. Johnson
#!/bin/sh
while [ “$INPUT” != “exit” ]
do
read -p "Please Enter Directory Name: " INPUT
if [ “$INPUT” != “exit” ]
then
if [ -d $INPUT ]
then
ls $INPUT
else
echo “$INPUT Is Not A Directory or unreadable”
fi
fi
echo $HOME
done
thanks that was a great help. Could you do another for me???
From: “jalal.hajigholamali via shellscript-l”
Hi,
If i understood your question, the answer is:
#!/bin/bash
count=0
while [ $count -le 10 ]
do
sleep 1
echo $count second passed
let count=count+1
done