Skip to content

Instantly share code, notes, and snippets.

@agudulin
Created October 16, 2012 22:21
Show Gist options
  • Save agudulin/3902433 to your computer and use it in GitHub Desktop.
Save agudulin/3902433 to your computer and use it in GitHub Desktop.
Bash: Homework OK
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Error!";
else
for arg in $@; do
if [ $arg == "name" ]; then
echo `whoami`;
elif [ $arg == "time" ]; then
echo `date +"%S:%M:%H %m.%d.%Y"`;
elif [ $arg == "nfile" ]; then
echo `ls | wc -l`;
elif [ $arg == "ndirs" ]; then
echo `ls -d */ | wc -l`;
else
echo "Error!!\n Help.";
fi;
done;
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment