|
|
Subscribe / Log in / New account

The Squirrel portable shell and scripting language (developerWorks)

Here's an overview of the Squirrel shell on developerWorks. "If you don't want to commit to the idiosyncrasies of the Fish shell, the Bash shell, the Z shell, the Windows operating system's cmd.exe, or some other shell scripting language, try the Squirrel Shell. The Squirrel Shell provides an advanced, object-oriented scripting language that works equally well in UNIX, Linux, Mac OS X, and Windows systems. You can write a script once and run it anywhere."

to post comments

The Squirrel portable shell and scripting language (developerWorks)

Posted Mar 18, 2009 17:17 UTC (Wed) by danielpf (guest, #4723) [Link] (4 responses)

Before using yet another language I would like to grasp the advantage of Squirrel over already popular languages like, say, Python (for the "advanced, object-oriented" and ubiquity aspects).


The Squirrel portable shell and scripting language (developerWorks)

Posted Mar 18, 2009 17:25 UTC (Wed) by atai (subscriber, #10977) [Link] (3 responses)

Squirrel is smaller than Python; actually think it more like Lua than Python, but with a C/C++ like Syntax...

The Squirrel portable shell and scripting language (developerWorks)

Posted Mar 18, 2009 18:36 UTC (Wed) by tzafrir (subscriber, #11501) [Link] (2 responses)

You must write a \; at the end of each comamnd. Annoying;

I figure that the author had some SQL shell in mind;

There's also some excessive use of ();

exit();

Too verbose

Posted Mar 18, 2009 20:30 UTC (Wed) by man_ls (guest, #15091) [Link] (1 responses)

Indeed:
  > printl( getenv( "HOME" ) );
And this instead of:
  $ echo $HOME
2.5 times as many characters. For this level of verboseness I prefer Python instead.

To quote the original article,

Posted Mar 19, 2009 1:00 UTC (Thu) by atai (subscriber, #10977) [Link]

Squirrel Shell isn't much of an interactive shell, but that's okay. There are many alternatives in that category already. Squirrel Shell is far better as a script runner. Its data structures are more capable than a traditional shell, it's syntax is familiar, and its underlying virtual engine supports everything from enumerated types to threads. The Squirrel engine is also tiny, at less than 6000 lines of code. You can even embed all of Squirrel in another application.

The Squirrel portable shell and scripting language (developerWorks)

Posted Mar 18, 2009 18:48 UTC (Wed) by chojrak11 (guest, #52056) [Link]

They compare to cmd.exe. But comparing to more realistic alternative, Squirrel is not even 1% of the PowerShell... Squirrel is so verbose (so many lines for such a simple feature `reveal') and dirty (no apparent logical structure -- they say it's object oriented, but `filetype', `filename', is of which object?) Many unneccessary curly braces and ()s everywhere. Not convincing.

The Squirrel portable shell and scripting language (developerWorks)

Posted Mar 19, 2009 14:54 UTC (Thu) by Tuxie (guest, #47191) [Link] (2 responses)

Personally I think it's stupid to call it a "shell", because it doesn't have any shell semantics like simple pipes, redirections and job control, and to run the external program foo you have to write run("foo"). This is just yet another scripting language like ruby/perl/python, and a pretty bad one at that (IMHO).

How do you do the following typical shell-pattern in Squirrel?
cat /tmp/foo*.txt | grep -v ^bar | sed 's:foo:bar:g' | myprogram

The Squirrel portable shell and scripting language (developerWorks)

Posted Mar 20, 2009 9:48 UTC (Fri) by odie (guest, #738) [Link] (1 responses)

Quoting the Squirrel shell manual:

"Squirrel Shell 1.0rc2 and newer support input, output and error streams redirection for child processes."

I believe it is done with variables, but I don't know any Squirrel, so can't comment on whether it's usable or not.

Oh, and by the way, I believe there is an award for the kind of blatant overuse of pipes in your example. Next time, try:
sed '/^bar/ ! s:foo:bar:g' /tmp/foo*.txt | myprogram

The Squirrel portable shell and scripting language (developerWorks)

Posted Mar 21, 2009 22:46 UTC (Sat) by mp (subscriber, #5615) [Link]

I believe your variant does something noticeably different.
Next time, try:
sed '/^bar/d; s:foo:bar:g'


Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds