-
-
Save smartree/d73cef5bf9132199e05e6ea288a5dfa7 to your computer and use it in GitHub Desktop.
Switch postgresql version for all the commands with using alternatives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # alternatives-pgsql | |
| # | |
| # Switch postgresql version for all the commands with using alternatives. | |
| # | |
| # Copyright(C) 2012 Uptime Technologies, LLC. All rights reserved. | |
| PATH=/usr/sbin:$PATH | |
| export PATH | |
| NUM=$1 | |
| if [ -z $NUM ]; then | |
| echo "id must be specified. abort." | |
| echo "Usage; $0 <num>" | |
| echo "" | alternatives --config pgsql-psql | grep bin/psql | |
| echo | |
| exit; | |
| fi; | |
| find /etc/alternatives/pgsql-* | \ | |
| perl -e 's,.*/,,' -p | \ | |
| awk '{ print "echo '$NUM' | alternatives --config " $1 }' | \ | |
| sh | |
| echo "" | alternatives --config pgsql-psql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment