#!/bin/bash # syncgdrive -- Lets you specify one or more files to automatically copy # to your Google Drive folder, which syncs with your cloud account. setglobal gdrive = ""$HOME/Google Drive"" setglobal gsync = ""$gdrive/gsync"" setglobal gapp = '"Google Drive.app'" if test $Argc -eq 0 { echo "Usage: $[basename $0] [file or files to sync]" > !2 ; exit 1 } # First, is Gdrive running? If not, launch it if test -z $[ps -ef | grep $gapp | grep -v grep] { echo "Starting up Google Drive daemon..." open -a $gapp } # Now, does the /gsync folder exist? if test ! -d $gsync { mkdir $gsync if test $Status -ne 0 { echo "$[basename $0]: Failed trying to mkdir $gsync" > !2 exit 1 } }for name in @Argv { echo "Copying file $name to your Google Drive" cp -a $name "$gdrive/gsync/" } exit 0