I have a shell script with different methods.The script is
status(){
PID=$(ps -ef | grep jmeter_script.sh|grep -v grep|awk '{print $2}')
}
start(){
shift
if [ "$#" -ne 2 ]; then
exit 1;
fi
jmeter.sh -n -t "$1" -l "$2"
}
stop(){
while true; do
read -p "Do you really want to stop?" yn
case $yn in
[Yy]* ) ps -ef | grep jmeter | grep -v grep | awk '{print $2}'|xargs kill; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
view(){
#some code
}
####Main
while [ "$1" != "" ]; do
case "$1" in
start )
start
;;
stop)
stop
;;
status)
status
;;
view)
view
;;
*)
echo $"Usage: $0 {start|stop|status|view}"
exit 1
esac
shift
done
When I try to run the script using ./jmeter_script.sh start abc.jmx log.jtl
I get an error saying ./jmeter_script.sh: 19: shift: can't shift that many
and then exit. I am running my script on ubuntu
server. I have tried to resolve this but I ddin't find any proper link for this error. Someone please help.