On Thu, Aug 3, 2017 at 12:36 AM, Daniel Campbell <[email protected]> wrote:
> On 08/01/2017 10:00 AM, Ian Zimmerman wrote:
>> On 2017-08-01 03:00, Daniel Campbell wrote:
>>
>>> # Add '-s' to interactively set the window to be captured.
>>> screenie() {
>>>      local curdir=$(pwd)
>>>      local shotname=$(date +%Y-%m-%d_%H-%M).png
>>>      echo "5 seconds! Go go go!"
>>>      cd ~/img/screens/comp/
>>>      scrot -d 5 -q 70 "$shotname" ${@}
>>>      echo "Screen taken! Find it under ~/img/screens/comp."
>>>      cd $curdir
>>> }
>>>
>>> (now that I'm looking at it, it could use a spruce up to use pushd/popd
>>> instead of storing the starting dir in a variable...)
>>
>> pushd and popd are bashisms, your current way works with any POSIX shell.
>>
> That's good to know!
>
> I went in search of a few portable shell resources. Some suggest to use
> dash or posh for the testing environment. I also found shellcheck, which
> looks pretty promising (and it's in the tree! Thanks jlec). Do you have
> any experience in portable shell scripting? My web search didn't return
> a whole lot of good resources. Mostly just Stack Overflow and a few
> tutorials which pointed to other resources.
>
> What do you suggest?

Ash, BusyBox's shell, is a good testing environment. Vim's syntax
highlighting will make Bashisms bright red if the shebang line
specifies /bin/sh.

Reply via email to