This is what I ended up using in my bash script:
ipconfig getifaddr en1 | sed s'_^_http://_' | pbcopy
it adds http:// at the front of the ip address
On May 11, 2:41 pm, Cameron <[EMAIL PROTECTED]> wrote:
> Hey guys,
>
> I got everything working per your discussion with one barely evening
> annoying hiccup... Pbcopy adds a newline character to the copied IP
> address. The result is that if you past it into the terminal, it
> interprets it immediately as a command -- that is, hitting ctrl+v is
> equivalent to typing 10.0.1.2 and hitting enter. I thought I might be
> able to take care of it with regex, but this didn't work:
>
> ipconfig getifaddr en1 | egrep "^([0-9]{1,3}\.){3}[0-9]{1,3}$" |
> pbcopy
>
> I can live with the newline char, but if anyone has a quick fix, I'd
> appreciate it. (I'm also pretty new to regex so if anyone has
> suggestions, please share them.)
>
> cb
>
> On May 9, 7:24 am, Howard Melman <[EMAIL PROTECTED]> wrote:
>
> > Glad that's working. I have "Run Tasks in Background" unchecked and
> > if I remember correctly people reported that checking it caused some
> > stability problems.
>
> > Howard
>
> > On May 9, 2008, at 9:18 AM, Ryan S wrote:
>
> > > OK, so by I stroke of luck I figured it out. I reasoned that the
> > > problem was the terminal window. For some reason it would work fine if
> > > the command acted in a terminal window or when the output was piped to
> > > the qs command. I figured that the script needed to be executed in the
> > > background. I was looking for a way to call the command with the &
> > > symbol after it so it would run in the background. For some reason I
> > > was skimming through the qs preferences and was looking in Extras when
> > > I noticed a check box to "Run Tasks in Background" checked that and
> > > everything is groovy now, pbcopy works fine. Woooo
>
> > > On May 7, 1:13 pm, Ryan S <[EMAIL PROTECTED]> wrote:
> > >> I get the run command to come up when I select the shell script
> > >> getLocalIP and can run it. If I redirect the output to qs as in:
> > >> ipconfig getifaddr en1 | qs
>
> > >> It will come up fine in qs. But if I use the pbcopy the clipboard
> > >> doesn't have it. Also if I activate the script and use Run In
> > >> Terminal
> > >> it will work fine too so I am guessing it has to do with an actual
> > >> shell being active. I think you can use an amersand when you call a
> > >> script to have it execute in the background but I wouldn't know how
> > >> to
> > >> get that to work from quicksilver
>
> > >> I am sure Get IP will work but I have some ideas for other shell
> > >> scripts I would like to have triggered by qs that will use pasteboard
> > >> stuff so I kinda want to figure out what is going on.
>
> > >> On May 7, 10:07 am, Howard Melman <[EMAIL PROTECTED]> wrote:
>
> > >>> I tried this an it seemed to work (though I don't have growlnotify).
> > >>> I did chmod +x and had to name the script with a .sh extension for
> > >>> the
> > >>> Run action to be available.
> > >>> FYI, the Run action had a terminal icon.
> > >>> Since I don't have growlnotify I didn't see the notification but I
> > >>> did
> > >>> check that the clipboard history was modified correctly.
>
> > >>> FYI, the Extra Scripts plugin has two related scripts, Get IP and
> > >>> Get
> > >>> External IP. Both are apple scripts and display the ip using Large
> > >>> Type.
>
> > >>> Howard
>
> > >>> On May 7, 2008, at 9:46 AM, Ryan S wrote:
>
> > >>>> I just want to execute this simple script from qs: (copies current
> > >>>> local IP to clipboard)
>
> > >>>> #!/usr/bin/env bash
>
> > >>>> ipconfig getifaddr en1 | pbcopy
> > >>>> growlnotify -m "Local IP copied to clipboard"
>
> > >>>> While it will work fine if I just double click on it to run when
> > >>>> it is
> > >>>> executed from quicksilver it doesn't work. If I pipe the ip to
> > >>>> the qs
> > >>>> command however it will bring the local ip into quicksilver. Also
> > >>>> if I
> > >>>> choose Run In Terminal from qs rather than just Run than it works
> > >>>> as
> > >>>> well.
>
> > >>>> Any thoughts?