Create a 'pokemonthink' script
A 'pokemonthink.sh' was created in the repository. And the install script creates a 'pokemonthink' script in the bin folder. The 'pokemonthink' script calls pokemonsay, but using the --think option... That's all!
This commit is contained in:
39
install.sh
39
install.sh
@@ -3,7 +3,8 @@
|
|||||||
# Define install directories and names
|
# Define install directories and names
|
||||||
install_path="$HOME/.pokemonsay"
|
install_path="$HOME/.pokemonsay"
|
||||||
bin_path="$HOME/bin"
|
bin_path="$HOME/bin"
|
||||||
bin_name="pokemonsay"
|
pokemonsay_bin="pokemonsay"
|
||||||
|
pokemonthink_bin="pokemonthink"
|
||||||
|
|
||||||
# Make sure the directories exist
|
# Make sure the directories exist
|
||||||
mkdir -p $install_path/
|
mkdir -p $install_path/
|
||||||
@@ -13,9 +14,10 @@ mkdir -p $bin_path/
|
|||||||
# Copy the cows and the main script to the install path.
|
# Copy the cows and the main script to the install path.
|
||||||
cp ./cows/*.cow $install_path/cows/
|
cp ./cows/*.cow $install_path/cows/
|
||||||
cp ./pokemonsay.sh $install_path/
|
cp ./pokemonsay.sh $install_path/
|
||||||
|
cp ./pokemonthink.sh $install_path/
|
||||||
|
|
||||||
# Create a bin script in the home bin directory.
|
# Create the pokemonsay script in the home bin directory.
|
||||||
cat > $bin_path/$bin_name <<- EOF
|
cat > $bin_path/$pokemonsay_bin <<- EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# This script changes to the pokemonsay installation directory,
|
# This script changes to the pokemonsay installation directory,
|
||||||
@@ -28,6 +30,20 @@ cat > $bin_path/$bin_name <<- EOF
|
|||||||
cd \$current_path
|
cd \$current_path
|
||||||
EOF
|
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
|
# Create uninstall script in the install directory
|
||||||
cat > $install_path/uninstall.sh <<- EOF
|
cat > $install_path/uninstall.sh <<- EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
@@ -39,19 +55,22 @@ cat > $install_path/uninstall.sh <<- EOF
|
|||||||
# Remove the install directory
|
# Remove the install directory
|
||||||
rm -r "$install_path/"
|
rm -r "$install_path/"
|
||||||
|
|
||||||
# Remove the bin file
|
# Remove the bin files
|
||||||
rm "$bin_path/$bin_name"
|
rm "$bin_path/$pokemonsay_bin"
|
||||||
|
rm "$bin_path/$pokemonthink_bin"
|
||||||
|
|
||||||
# Say what's going on.
|
# Say what's going on.
|
||||||
echo "'$install_path/' directory was removed."
|
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
|
EOF
|
||||||
|
|
||||||
# Change permission of the generated scripts
|
# Change permission of the generated scripts
|
||||||
chmod +x $bin_path/$bin_name
|
chmod +x "$bin_path/$pokemonsay_bin"
|
||||||
chmod +x $install_path/uninstall.sh
|
chmod +x "$bin_path/$pokemonthink_bin"
|
||||||
|
chmod +x "$install_path/uninstall.sh"
|
||||||
|
|
||||||
echo "The files were installed to '$install_path/'."
|
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 "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."
|
||||||
|
|||||||
7
pokemonthink.sh
Executable file
7
pokemonthink.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Call pokemonsay with the think option.
|
||||||
|
#
|
||||||
|
|
||||||
|
./pokemonsay.sh --think $@
|
||||||
Reference in New Issue
Block a user