.bashrc command to quickly download WordPress
.bashrc
snippet. .bashrc
is great configuration for all the linux terminal geek. And now a days not only linux but lots of windows based developer enjoying this cool feature via GIT bash. If you want use that on windows, check this post – “Setting up dev environement for WAMP developer“The Snippet
# ----------------------------------
# Download WordPress and extract it
# ----------------------------------
getwp(){
#if folder name specified
if [ $@ ]; then
# If that folder is not exist
if [ -x./$@ ]; then
mkdir ./$@
fi
fi
cd ./$@
# If you don't have curl installed - you can use wget.
# wget -O ./wordpress.tar.gz "http://wordpress.org/latest.tar.gz"
curl -o ./wordpress.tar.gz http://wordpress.org/latest.tar.gz
tar -xvzf ./wordpress.tar.gz
rm ./wordpress.tar.gz
mv ./wordpress/* ./
rm -r ./wordpress
echo '-------------------------'
echo 'Finished getting wordpress'
}
Paste the above snippet in your ~/.bashrc file and restart your console or source your .bashrc by typing source ~/.bashrc
.
Once you are done with above, you can just type in your terminal –
getwp
and it will
- Download latest version of wordpress.
- Extract downloaded archive file in the current directory
- Remove all temporary files (ex. the downloaded wordpress archive file)
You can also use following command –
getwp directoryName
This will create a new directory direcotoryName
if not already exist and download the wordpress in that directory.
Let me know if you like this snippet. Also let me know your feedback/ideas so that I can improve that snippet and do more cool stuffs with it.