Here's the next cartoon in the series about famous computer scientists. Here is John McCarthy. The creator. Inventor of Lisp and the father of modern artificial intelligence.


John McCarthy - The Creator

In case you're joining just now, here are the previous comics:

Like this? Subscribe to comic and/or follow browserling and/or me on Twitter and/or do nothing.

Until next time!

Here's something you didn't know about bash functions. Usually when you write a function you do this:

function name () {
  ...
}

Right? I know you do, because that's how everyone writes functions. Well, here's the thing. In bash { ... } doesn't mean "function's body" or "function's scope" as in JavaScript or C. It's actually a compound command. You can do all kinds of fancy things like this:

function fileExists () [[ -f $1 ]]

No need for those curly braces! Function is the test command itself. Or you can do this:

function isEven () (( $1 % 2 == 0 ))

Here function is an arithmetic expression. Or you can do this:

function name () (
  ...
)

This will spawn the function in a subshell rather than execute it in the current environment.

Or you can use while, if, case, select and for. Here's an example:

function sleep1 () while :; do "$@"; sleep 1; done

This one creates a function sleep1 that runs a command every one second forever. You can do things like sleep1 df -h to monitor how your disk changes.

Not only do these tricks make your code nicer and let you write quick bash one liners, but they also are super useful. It's especially useful if you need to create a temporary environment for your function and temporarily change variables or shell options. Here's an example I found somewhere in my code:

function caseInsensitiveMatch () (
    shopt -s nocasematch
    ....
)

Here funtion caseInsensitiveMatch executes in a subshell and sets nocasematch option and its scope is just this function. Similarly for IFS and other variables you often need a temporarily change. No need to save previous values, then restore them.

This was my quick 5 minute shell tip. Look up compound commands in bash man page to find all the possibilities. Once you master this, you'll start writing some next level shell code. Until next time!

This article is part of my upcoming book Bash One Liners (freely available on my blog.)

Success happens!

I just hit 700 days of commits to Browserling's private repo on Github:

The more I commit, the more Browserling grows. February was another record month for my company:

Update: 2017-04-01

Update: 2017-05-01

Update: 2017-06-01

I'm on a mission to build a great company. Until next time!

Super exciting news! I just added Android 7.1 Nougat to Browserling. You can now cross-browser test your websites in this latest Android version.

Android Nougat is now available to all free and paid users. Click this link to instantly launch an Android in your browser:

https://www.browserling.com/browse/android/7.1/http://www.digg.com

Click link, get Android!

In general you can open any website on Android 7.1 by modifying the URL part of the link:

https://www.browserling.com/browse/android/7.1/URL

Until next time!

This blog post is a repost of Android 7.1 Nougat Added to Browserling from Browserling's cross-browser testing blog.

Here's the third comic in the series about famous computer people. Grace Hopper always walked around with 1 foot long wires in her purse as that's how far light travels in 1 nanosecond. Remember that. 1ft = 1ns!


Grace Hopper: "Light travels 1 foot in 1 nanosecond."

Like this? Subscribe to comic and/or follow browserling and/or me on Twitter and/or do nothing.

Until next time!