shell script for using docs as default office suite

8 views
Skip to first unread message

SilasMortimer

unread,
Dec 30, 2010, 8:02:05 AM12/30/10
to GoogleCL Discuss
Hiya. I'm trying to make a $Subject and thus far I have something
usable with a mere two lines, a-like so:

#!/bin/sh

google -u Pandarsson docs upload "$@" --title "$@"
kde-open `google docs list url -n "$@"`

Success! Good job, guys! That rocked!

Okay, so the problem, of course, comes when there are two of the same
document. To test, I used the script on a file called notes.txt, then
deleted it, made a new notes.txt and used the script on that, as well.
The good news is that it opened the second one properly, but that left
two documents of the same name. That's okay, as long as the new one is
the first URL listed, is it always?

If you can tell me yes for sure, then I'll just finish it up with
making a backup folder to move all the files to and make URL files of
the same name using the unique URL. But wait, how do I only put the
top URL in the file?

Dang.

Tom Miller

unread,
Jan 2, 2011, 9:19:23 AM1/2/11
to googlecl...@googlegroups.com
On Thu, Dec 30, 2010 at 8:02 AM, SilasMortimer <panda...@gmail.com> wrote:
> Hiya. I'm trying to make a $Subject and thus far I have something
> usable with a mere two lines, a-like so:
>
> #!/bin/sh
>
> google -u Pandarsson docs upload "$@" --title "$@"
> kde-open `google docs list url -n "$@"`
>
> Success! Good job, guys! That rocked!
>
> Okay, so the problem, of course, comes when there are two of the same
> document. To test, I used the script on a file called notes.txt, then
> deleted it, made a new notes.txt and used the script on that, as well.
> The good news is that it opened the second one properly, but that left
> two documents of the same name. That's okay, as long as the new one is
> the first URL listed, is it always?

(If I recall correctly) Docs will always give you the most recently
edited entries first. It may be possible to specify dates of documents
you want to list, but even if that's possible, the feature has not
been built into GoogleCL yet. Does anyone know if that can be done
with the Docs API?

>
> If you can tell me yes for sure, then I'll just finish it up with
> making a backup folder to move all the files to and make URL files of
> the same name using the unique URL. But wait, how do I only put the
> top URL in the file?

These two articles can probably point you in the right direction:
http://www.linuxquestions.org/questions/linux-software-2/bash-split-by-newline-617175/
http://stackoverflow.com/questions/918886/split-string-based-on-delimiter-in-bash

- Tom

Reply all
Reply to author
Forward
0 new messages