Created
December 14, 2014 00:35
-
-
Save p1nesap/2442748e8cde4b541f80 to your computer and use it in GitHub Desktop.
Fun with operators, conditionals and exported functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Fun with operators, conditionals and exported functions. Notes below. | |
y=$(date +%Y) | |
d=$(date +%d) | |
m=$(date +%m) | |
u=`whoami` | |
s=`pwd` | |
if [ $d -lt 25 ] && [ $m == 12 ] && [[ "$s" == *"home/phoebe/shell"* ]] | |
then | |
echo "Hi $u, it's before Christmas, and you're in shell directory!" | |
else [ $m -lt 12 -a $m -ge 1 ] || [[ "$s" != *"home/phoebe/shell"* ]] | |
echo "Hi $u, it's past Christmas, or you're not in shell directory." | |
echo -n "Type which directory, shell or Videos: " | |
read directory | |
if [[ $directory == "shell" ]] | |
then | |
cdshell | |
elif [[ $directory == "Videos" ]] | |
then | |
cdVideos | |
else | |
echo "Invalid choice." | |
fi | |
fi | |
: ' | |
Open file with . /path to free source, in ~/.bashrc: | |
function cdshell() { | |
cd /home/phoebe/shell "$@" | |
} | |
export -f cdshell` | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment