diff --git a/install.sh b/install.sh index 0d05f33..21bd60d 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,8 @@ # Define install directories and names install_path="$HOME/.pokemonsay" bin_path="$HOME/bin" -bin_name="pokemonsay" +pokemonsay_bin="pokemonsay" +pokemonthink_bin="pokemonthink" # Make sure the directories exist mkdir -p $install_path/ @@ -13,9 +14,10 @@ mkdir -p $bin_path/ # Copy the cows and the main script to the install path. cp ./cows/*.cow $install_path/cows/ cp ./pokemonsay.sh $install_path/ +cp ./pokemonthink.sh $install_path/ -# Create a bin script in the home bin directory. -cat > $bin_path/$bin_name <<- EOF +# Create the pokemonsay script in the home bin directory. +cat > $bin_path/$pokemonsay_bin <<- EOF #!/bin/sh # This script changes to the pokemonsay installation directory, @@ -28,6 +30,20 @@ cat > $bin_path/$bin_name <<- EOF cd \$current_path EOF +# Create the pokemonthink script in the home bin directory. +cat > $bin_path/$pokemonthink_bin <<- EOF + #!/bin/sh + + # This script changes to the pokemonsay installation directory, + # runs the main script for running the pokemonthink, and changes + # back to the previous directory. + + current_path=`pwd` + cd $install_path/ + ./pokemonthink.sh \$@ + cd \$current_path +EOF + # Create uninstall script in the install directory cat > $install_path/uninstall.sh <<- EOF #!/bin/sh @@ -39,19 +55,22 @@ cat > $install_path/uninstall.sh <<- EOF # Remove the install directory rm -r "$install_path/" - # Remove the bin file - rm "$bin_path/$bin_name" + # Remove the bin files + rm "$bin_path/$pokemonsay_bin" + rm "$bin_path/$pokemonthink_bin" # Say what's going on. echo "'$install_path/' directory was removed." - echo "'$bin_path/$bin_name' file was removed." + echo "'$bin_path/$pokemonsay_bin' file was removed." + echo "'$bin_path/$pokemonthink_bin' file was removed." EOF # Change permission of the generated scripts -chmod +x $bin_path/$bin_name -chmod +x $install_path/uninstall.sh +chmod +x "$bin_path/$pokemonsay_bin" +chmod +x "$bin_path/$pokemonthink_bin" +chmod +x "$install_path/uninstall.sh" echo "The files were installed to '$install_path/'." -echo "A '$bin_name' script was created in '$bin_path/'." +echo "A '$pokemonsay_bin' script was created in '$bin_path/'." echo "A uninstall script was created in '$install_path/'." -echo "It may be necessary to logout and login back again in order to have the '$bin_name' available in your path." +echo "It may be necessary to logout and login back again in order to have the '$pokemonsay_bin' available in your path." diff --git a/pokemonthink.sh b/pokemonthink.sh new file mode 100755 index 0000000..77979fe --- /dev/null +++ b/pokemonthink.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# +# Call pokemonsay with the think option. +# + +./pokemonsay.sh --think $@