-
Notifications
You must be signed in to change notification settings - Fork 23
gitbash
David Pérez-Suárez edited this page Apr 17, 2020
·
3 revisions
GitBash gives a very basic bash shell to run on Windows, but it doesn't come with script.
However, there's a workaround which involves adding busybox to your GitBash.
This script installs busybox and shellshare.
You can save this script
#!/bin/bash
#
# if file is accessible from the web:
# /bin/bash -c "$(curl -fsSL https://location.to/file/get_shellshare)"
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
# Download script
if [[ ! -x /usr/bin/script ]]; then
mkdir busybox
pushd busybox
curl -sO http://repo.msys2.org/msys/x86_64/busybox-1.23.2-1-x86_64.pkg.tar.xz
tar Jxf busybox-1.23.2-1-x86_64.pkg.tar.xz
cp usr/bin/busybox.exe /usr/bin/ 2> /dev/null
if [[ $? -gt 0 ]]; then
# git may have been installed system-wide, and it's not writable unless run as administrator.
mkdir -p ~/.bin
cp usr/bin/busybox.exe ~/.bin/ 2> /dev/null
ln -s ~/.bin/busybox.exe ~/.bin/script.exe
echo 'export PATH="${HOME}/.bin/:${PATH}"' >> ~/.bash_profile
echo 'Please, close this shell and open a new one for the changes to take effect.'
else
ln -s /usr/bin/busybox.exe /usr/bin/script.exe
fi
popd
rm -rf busybox
fi
# Download shellshare
if [[ ! -f shellshare ]]; then
curl -sLO shellshare https://get.shellshare.net
fi
hash python 2>/dev/null || { echo >&2 "Install python and make sure is accessible by gitbash."; exit 1; }
and run it as:
/bin/bash get_shellshare.sh
Thanks to Mike Renfro (@mikerenfro) for knowing about busybox and all the patience to test it across the world 😉