[dundee] Help with Bash Shell

azmodie azmodie at gmail.com
Thu Mar 31 11:41:15 UTC 2011


for curl
curl –X PUT http://couchdb:port/db

"-d @filename" reads the post from a given file name, and "-d @-" reads the
post data from stdin!

azmodie

On 31 March 2011 12:26, Rick Moynihan <rick.moynihan at gmail.com> wrote:

> I suspect you might be surpassing the maximum commandline argument limit.
>
> You might want to look at piping stdin directly into to curl... I
> think it takes a - argument that'll do this.
>
> R.
>
> On 31 March 2011 10:40, Gary Short <gary at garyshort.org> wrote:
> > Yeah works here too, if I input a short line. The JSON lines are looong,
> > that's why I thought maybe some buffer issue or something. Anyhoo, that
> > didn't work either, sorry, though it did put the single quote in exactly
> the
> > same place near the end of the line. I've messed around with this long
> > enough, I'm going to try python now I think. Shame Bash didn't work as it
> > would have been a nice, short, simple solution.
> >
> > Thanks for your help.
> >
> > Gary
> >
> >> -----Original Message-----
> >> From: dundee-bounces at lists.lug.org.uk [mailto:dundee-
> >> bounces at lists.lug.org.uk] On Behalf Of Robert Ladyman
> >> Sent: 31 March 2011 10:33
> >> To: Tayside Linux User Group
> >> Subject: Re: [dundee] Help with Bash Shell
> >>
> >> Err...well, it works here (as the old saying goes): I suspect that
> >> something
> >> in the data is being interpreted as a bash command.
> >>
> >> Try
> >>
> >> echo \'$data\'
> >>
> >> (that's slash-quote)
> >>
> >>
> >>
> >> > Weird, Bash inserts the single quote near the end of the string. It's
> >> like
> >> > $data isn't all there when the quote is added and then the rest of it
> >> > "catches up". Tried putting in a sleep 1, but that made no difference
> >> so I
> >> > don't think it's a timing issue. Tried saving $data locally first so
> >> as to
> >> > try and flush any buffer, didn't work either. Weird. Linux sucks. ;-)
> >> >
> >> > > -----Original Message-----
> >> > > From: dundee-bounces at lists.lug.org.uk [mailto:dundee-
> >> > > bounces at lists.lug.org.uk] On Behalf Of 'Gary Short'
> >> > > Sent: 31 March 2011 09:38
> >> > > To: 'Tayside Linux User Group'
> >> > > Subject: Re: [dundee] Help with Bash Shell
> >> > >
> >> > > Thanks Robert,
> >> > >
> >> > > And that nearly works too! :-)
> >> > >
> >> > > Echoing "'$data'" (to see what gets sent to couchdb) gives me
> >> > >
> >> > > '{"key":"value" ... }
> >> > >
> >> > > Note, no single quote at the end, no idea why Bash doesn't append
> >> it,
> >> > > it's
> >> > > there in the code, but of course, without it, Couchdb returns "bad
> >> > > JSON".
> >> > >
> >> > > Sigh... may have to break out Python
> >> > >
> >> > > Thanks for your help
> >> > >
> >> > > Cheers,
> >> > > Gary
> >> > >
> >> > > > -----Original Message-----
> >> > > > From: dundee-bounces at lists.lug.org.uk [mailto:dundee-
> >> > > > bounces at lists.lug.org.uk] On Behalf Of Robert Ladyman
> >> > > > Sent: 31 March 2011 05:09
> >> > > > To: Tayside Linux User Group
> >> > > > Subject: Re: [dundee] Help with Bash Shell
> >> > > >
> >> > > > Whoops - that should be:
> >> > > > QUOTED_DATA="'$data'"
> >> > > >
> >> > > > although the echo would work
> >> > > >
> >> > > > > if that fails, use the echo trick above and put the result into
> >> a
> >> > >
> >> > > new
> >> > >
> >> > > > >  variable
> >> > > > >
> >> > > > > QUOTED_DATA=`echo "'$data'"`
> >> > > > >
> >> > > > > note the back-ticks around the right-hand statement
> >> > > >
> >> > > > --
> >> > > > Robert Ladyman
> >> > > > File-Away Limited
> >> > > > 3 Ralston Business Centre, Newtyle, Blairgowrie
> >> > > > Perthshire  PH12 8TL SCOTLAND
> >> > > > Tel: +44 (0) 1828 898 158
> >> > > > Mobile: +44 (0) 7732 771 649
> >> > > > http://www.file-away.co.uk
> >> > > >
> >> > > > ============================================
> >> > > > Registered Office: 32 Church Street, Newtyle, Blairgowrie
> >> > > > Perthshire, PH12 8TZ SCOTLAND
> >> > > > Registered in Scotland, Company Number SC222086
> >> > > >
> >> > > >
> >> > > > _______________________________________________
> >> > > > dundee GNU/Linux Users Group mailing list
> >> > > > dundee at lists.lug.org.uk  http://dundeelug.org.uk
> >> > > > https://mailman.lug.org.uk/mailman/listinfo/dundee
> >> > > > Chat on IRC, #tlug on irc.lug.org.uk
> >> > >
> >> > > _______________________________________________
> >> > > dundee GNU/Linux Users Group mailing list
> >> > > dundee at lists.lug.org.uk  http://dundeelug.org.uk
> >> > > https://mailman.lug.org.uk/mailman/listinfo/dundee
> >> > > Chat on IRC, #tlug on irc.lug.org.uk
> >> > >
> >> > >
> >> >
> >> > _______________________________________________
> >> > dundee GNU/Linux Users Group mailing list
> >> > dundee at lists.lug.org.uk  http://dundeelug.org.uk
> >> > https://mailman.lug.org.uk/mailman/listinfo/dundee
> >> > Chat on IRC, #tlug on irc.lug.org.uk
> >> >
> >>
> >> --
> >> Robert Ladyman
> >> File-Away Limited
> >> 3 Ralston Business Centre, Newtyle, Blairgowrie
> >> Perthshire  PH12 8TL SCOTLAND
> >> Tel: +44 (0) 1828 898 158
> >> Mobile: +44 (0) 7732 771 649
> >> http://www.file-away.co.uk
> >>
> >> ============================================
> >> Registered Office: 32 Church Street, Newtyle, Blairgowrie
> >> Perthshire, PH12 8TZ SCOTLAND
> >> Registered in Scotland, Company Number SC222086
> >>
> >>
> >> _______________________________________________
> >> dundee GNU/Linux Users Group mailing list
> >> dundee at lists.lug.org.uk  http://dundeelug.org.uk
> >> https://mailman.lug.org.uk/mailman/listinfo/dundee
> >> Chat on IRC, #tlug on irc.lug.org.uk
> >>
> >> !DSPAM:5,4d944af9290372356921523!
> >
> >
> >
> > _______________________________________________
> > dundee GNU/Linux Users Group mailing list
> > dundee at lists.lug.org.uk  http://dundeelug.org.uk
> > https://mailman.lug.org.uk/mailman/listinfo/dundee
> > Chat on IRC, #tlug on irc.lug.org.uk
> >
>
>
>
> --
> Rick Moynihan
> http://twitter.com/RickMoynihan
> http://delicious.com/InkyHarmonics
> http://sourcesmouth.co.uk/
>
> _______________________________________________
> dundee GNU/Linux Users Group mailing list
> dundee at lists.lug.org.uk  http://dundeelug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/dundee
> Chat on IRC, #tlug on irc.lug.org.uk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/dundee/attachments/20110331/7d2531dd/attachment-0001.htm>


More information about the dundee mailing list