The time taken to execute a particular command (e.g. ls -ltr) can be saved to a file.
This can be useful when your shell script takes a lot of time and you want to profile the time taken by various commands.
-----------------------------
#!/bin/bash
"Time taken by ls" 2>> time.txt
{ time {
ls -ltr
} } 2>> time.txt
"Time taken by cat" 2>> time.txt
{ time {
cat test.sh;
} } 2>> time.txt
----------------------------
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment