PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Execution Time Bash On Linux Shell Script Timing

Go down

Execution Time Bash On Linux Shell Script Timing Empty Execution Time Bash On Linux Shell Script Timing

Post by jamied_uk 23rd July 2016, 16:58




Code:
#!/bin/bash
# (c) J~Net 2016
#Usage Example ./time.sh "test.sh"
#time yourscript.sh
myvar="$@"
start=`date +%s'` # +%ms +%s

sh "$myvar"

#free
# or other commands

end=`date +%s`
runtime=$((end-start))
echo "Runtime: $runtime"



Update Files Link
app.box.com/s/dxmrui2dg6f6qc61vacshxw1frhcyte9


Last edited by jamied_uk on 23rd July 2016, 18:16; edited 1 time in total
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Execution Time Bash On Linux Shell Script Timing Empty Re: Execution Time Bash On Linux Shell Script Timing

Post by jamied_uk 23rd July 2016, 18:12

Time Loop

Vid


Code:
#!/bin/bash
# (c) J~Net 2016
#Usage Example ./time.sh "test.sh"
#time yourscript.sh
myvar="$@"
start=`date +%s'` # +%ms +%s

sh "$myvar"

#free
# or other commands

end=`date +%s`
runtime=$((end-start))
echo "Runtime: $runtime"
sleep 1
echo "Again?"
read -r -p "Are you sure? [Y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
# Run If Yes
bash time_loop.sh "$myvar"
else
echo "Thanks For Using Time Loop!"
# clear
exit
fi
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum