Skip to content

Instantly share code, notes, and snippets.

@ngsw
Created March 23, 2013 21:18
Show Gist options
  • Select an option

  • Save ngsw/5229392 to your computer and use it in GitHub Desktop.

Select an option

Save ngsw/5229392 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
##(snip)
# Appends a value to an array.
#
# @param [String] $1 Name of the variable to modify
# @param [String] $2 Value to append
function append() {
eval $1[\${#$1[*]}]=$2
}
#----------------------------------------------------------------------
# Script
#----------------------------------------------------------------------
# Collect the directories and files to remove
my_files=()
append my_files "/Applications/Vagrant"
append my_files "/usr/bin/vagrant"
# Print the files and directories that are to be removed and verify
# with the user that that is what he/she really wants to do.
echo "The following files and directories will be removed:"
for file in "${my_files[@]}"; do
echo " $file"
done
##(snip)
## http://downloads.vagrantup.com/tags/v1.1.2
## Mac :: Vagrant.dmg
## /Volumes/Vagrant/uninstall.tool
@ngsw
Copy link
Copy Markdown
Author

ngsw commented Mar 23, 2013

参考にする

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment