Skip to content

Instantly share code, notes, and snippets.

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