Created
May 20, 2013 18:47
-
-
Save paulosuzart/5614350 to your computer and use it in GitHub Desktop.
Firs fish functions to help daily.
This file contains 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
function -d "Adds a function with the machine name, so you can connect to it" addMachine | |
test -r $HOME/.config/fish/functions/$argv.fish; and rm $HOME/.config/fish/functions/$argv.fish; and echo "Replacing existing machine: $argv"; or echo "Seting up $argv" | |
echo "#Function added by addMachine" >> "$HOME/.config/fish/functions/$argv.fish" | |
echo "function -d \"connects to $argv machine.\" $argv" >> "$HOME/.config/fish/functions/$argv.fish" | |
echo " connect $argv" '$argv' >> "$HOME/.config/fish/functions/$argv.fish" | |
echo "end" >> "$HOME/.config/fish/functions/$argv.fish" | |
end |
This file contains 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
function -d "Connects to a given machine. dc and local domains are allowed" connect | |
echo $argv | |
set machine $argv[1] | |
set machineNumber $argv[2] | |
set domain $argv[3] | |
switch $domain | |
case prd | |
set domain your.prd.domain | |
case dev | |
set domain your.dev.domain | |
case '*' | |
echo Please inform the domain to connect to | |
end | |
echo "Connecting to $machine$machineNumber.$domain......." | |
ssh "$machine$machineNumber.$domain" -lroot -A | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment