23 October 2009

A lot of the material I went over was from the NYPHP presentation that I gave earlier this year, but I did spend a little more time on functionality specific to the bash prompt.

A couple of the things that seemed to generate the most enthusiasm:

  • Using "cd -" to toggle between the most recently viewed directories.
  • The use of GNU screen.
  • Using aliases, especially for aliasing mysql --safe-updates

Some of the attendees had their own useful suggestions. Daniel Nelson pointed out that Ctrl+N and Ctrl+P is faster than using arrow keys to navigate through your command history. He also pointed out that you could pass command output into arguments using parenthesis. For example:

diff <(ls -l) <(ls ../ -l)

That's pretty slick if you ask me!

A lot of PHP guys showed up, so there was some interest in a small function I wrote to parse out information from the php.net information pages. Here it is in it's full glory:

phpargs() {
    curl -s http://us3.php.net/$1 | \
        sed -n '/<div class="methodsynopsis dc-description">/,/<\/div>/p' | \
        sed 's/<[^>]*>//g' | tr -d "\n"

It's pretty basic, but if you add this to your bash profile you can run it by passing a function name.

phpargs strpos
int strpos    ( string $haystack   , mixed $needle   [, int $offset = 0  ] )

Again, if you're reading this and you're not checking out your local user groups, then I encourage you to do so! Even smaller cities often have user groups and they are a valuable place to both learn things and share what you know.

Related Links

blog comments powered by Disqus