Why bash/*nix rules

I’ve been doing some work on getting Conduit to play nicely with the version of PyGooCanvas found on Feisty. Initially, having no experience in this area at all, it was quite a challenge. Anway, i’ve got it mostly working but the code is now littered with log messages trying to figure out why an arrow won’t render. It’s gotten to the point where i am going to have to try and reproduce the bug outside of conduit, to see if it is a Conduit bug or a GooCanvas bug.

Why does this make bash/*nix rule? Simple. I need to access a PyGooCanvas demo. I know it’s called mv-simple, but i don’t know where it is saved:

john@laptop:~$ locate mv-simple
/home/john/Projects/pygoocanvas-0.6.0/demo/mv-simple-demo.py
Not bad, but this is old hat to me these days. What i hadn’t tried before, and made me smile, was:

john@laptop:~$ gedit `locate mv-simple`

And the demo was opened unto gedit, yay! No more copy and pasting the path for me. I also found this one to be helpful… It copies the file to my desktop where I intend to abuse it until I have the same SVG rendering glitch as in Conduit…
john@hx280:~$ cp `locate mv-simple` ./Desktop/

Unfortunately this method only opens the first thing in locates list – ideas on opening all files returned by locate welcomed :-) (Any xargs foo must be well explained O_O)

Tags:

2 Responses to “Why bash/*nix rules”

  1. jonnylamb says:

    echo `locate mv-simple` | xargs -i cp {} ~/Desktop

    Using the -i argument on xargs means it’ll replace {} with the arg (filename in this, and most, example), instead of just plonking it at the end.

  2. Evan says:

    WRT to opening multiple files . . . just use gvim instead of gedit!

    Ok, editor wars aside, I would use: locate mv-simple | xargs -n1 gedit

    The -n1 argument to xargs means that xargs should only pass 1 argument at a time to gedit — in other words it will open gedit once per file that locate returns.