* bin/time, bin/date: use case statement, performance improvement

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-06-17 17:42:22 -05:00
commit 079413bb99
2 changed files with 22 additions and 16 deletions

View file

@ -17,11 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ "$1" = "--detail" ]; then
case "$1" in
--detail)
date
exit 0
elif [ "$1" = "--short" ]; then
;;
--short)
date +%Y-%m-%d
exit 0
fi
;;
*)
printf "\005Y-\005m-\005d "
;;
esac

View file

@ -17,12 +17,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ "$1" = "--detail" ]; then
case "$1" in
--detail)
date
exit 0
elif [ "$1" = "--short" ]; then
;;
--short)
date +%H:%M:%S
exit 0
fi
;;
*)
printf "\0050c:\005s"
;;
esac