Skip to content

Commit

Permalink
Implement an 'auto' mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ldotlopez committed Sep 21, 2012
1 parent 9d7c0fa commit d30a0c8
Showing 1 changed file with 34 additions and 14 deletions.
48 changes: 34 additions & 14 deletions shello.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,35 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

echo "Choose a background colour:"
for colour in $(seq 40 47); do
echo -e "\033[1;"$colour"m $colour \033[0;37m \c"
done
echo -e "\n> \c"
read backgroundcolour
param_auto="false"
# Do simple parsing, getopt(s) is not used following the KISS principle
if [ "$1" = '-a' -o "$1" = '--auto' ]; then
param_auto="true"
fi

echo -e "\nChoose a foreground colour:"
for colour in $(seq 30 37); do
echo -e "\033[1;"$colour"m\033[1;"$backgroundcolour"m $colour \033[0;37m \c"
done
echo -e "\n> \c"
read foregroundcolour
if [ "$param_auto" = "true" ]; then
backgroundcolour=$[RANDOM%8+40]
echo -e "Auto choosing background color: \033[1;${backgroundcolour}m $backgroundcolour \033[0;37m"
else
echo "Choose a background colour:"
for colour in $(seq 40 47); do
echo -e "\033[1;"$colour"m $colour \033[0;37m \c"
done
echo -e "\n> \c"
read backgroundcolour
fi

if [ "$param_auto" = "true" ]; then
foregroundcolour=$[RANDOM%8+30]
echo -e "Auto choosing foreground color: \033[1;"$backgroundcolour"m\033[1;"$foregroundcolour"m $foregroundcolour \033[0;37m"
else
echo -e "\nChoose a foreground colour:"
for colour in $(seq 30 37); do
echo -e "\033[1;"$colour"m\033[1;"$backgroundcolour"m $colour \033[0;37m \c"
done
echo -e "\n> \c"
read foregroundcolour
fi

logos=(◉ ♥ ☕ ♫ ☢ ★ ☆ ☣ ☺ ☹ ✉ ☯ ✈ ☮ ✆ ⛃ ☠ ☃ ‽ ⊙)
echo -e "\nType a character or copy and paste one of these unicode ones:"
Expand All @@ -52,8 +68,12 @@ if [ -x "$(which hostname)" -a -x "$(which sed)" ]; then
echo "based on your hostname, we like this one: $suggestion"
fi

echo -e "> \c"
read character
if [ "$param_auto" = "true" ]; then
character="$suggestion"
else
echo -e "> \c"
read character
fi

echo -e "\nHere is your new shell logo:"
echo -e "\033[1;"$backgroundcolour"m\033[1;"$foregroundcolour"m $character \033[0;37m\n"
Expand Down

0 comments on commit d30a0c8

Please sign in to comment.