Skip to content

Instantly share code, notes, and snippets.

@chrisb13
Created March 31, 2017 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisb13/1624534c474e4e849c4de8abba1976fa to your computer and use it in GitHub Desktop.
Save chrisb13/1624534c474e4e849c4de8abba1976fa to your computer and use it in GitHub Desktop.
Bash function to use scp on NCI
function vimnci()
{
if [[ ( $# -eq 0 ) || ( $1 == "--help" ) || ( $1 == "-h" ) ]] ; then
echo "Usage: vimnci PATH_TO."
echo "Purpose: Allows remote editing of files on nci servers..."
echo " "
echo "Mandatory arguments: "
echo "path or file: vim will either edit or open file passed"
echo " "
echo "Example."
echo "This:"
echo "vimnci /home/561/cyb561/repos/scripts_not_in_repo/"
echo " "
echo "Becomes:"
echo "vim scp://cyb561@raijin.nci.org.au//home/561/cyb561/repos/scripts_not_in_repo/"
return 1
fi
#number of arguments...
#echo $#
if [ $# == 1 ]
then
vim scp://cyb561@raijin.nci.org.au/${1}
fi
if [ $# == 2 ]
then
vim -O scp://cyb561@raijin.nci.org.au/${1} scp://cyb561@raijin.nci.org.au/${2}
fi
if [ $# == 3 ]
then
vim -O scp://cyb561@raijin.nci.org.au/${1} scp://cyb561@raijin.nci.org.au/${2} scp://cyb561@raijin.nci.org.au/${3}
fi
if [ $# > 3 ]
then
echo 'you passed too many arguments!'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment