Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

What is this document about?

Across all of our content you will encounter examples of commands to execute on the command line.
While most of them will be run on a Squirro Server and hence will be on CentOS/RHEL and hence bash or zsh, there are moments when you will work with the Squirro Toolbox on Windows.

This document highlights some of the differences between the Linux / macOS based commands and the Windows variant. (cmd.exe or PowerShell) so that if you encounter a reference or example for one, you can easily get it to work on the other

Commands are logically the same

No matter what OS you are on, the Squirro Toolbox is the same, Python 3 based source code and application, hence all the commands and command arguments are the same.

The follow snippet will work on all supported operating systems:

Code Block
squirro_asset widget upload --token 7e1...... --cluster https://myinstance.squirro.com -f mywidget

Multi Line Command

Since one liners can be hard to read, we split them often into multiple line. Different command line interpreters have different characters.

Linux / Mac (e.g. bash or zsh)

Code Block
squirro_asset widget upload \
--token 7e1...... \
--cluster https://myinstance.squirro.com \
-f mywidget

Windows (cmd.exe)

Code Block
squirro_asset widget upload ^
--token 7e1...... ^
--cluster https://myinstance.squirro.com ^
-f mywidget

The difference here is the backlash character / vs the caret character ^.

Variables

In the above example i’m using the token and cluster values directly in the command.
It is best practice not to do that, as it has security implications and its not re-usable.. It is better to use environment variables

Linux / Mac (e.g. bash or zsh)

Code Block
squirro_asset widget upload \
--token $TOKEN \
--cluster $CLUSTER \
-f mywidget

Windows (cmd.exe)

Code Block
squirro_asset widget upload ^
--token %TOKEN% ^
--cluster %CLUSTER% ^
-f mywidget

The difference here is that bash/zsh uses the $ character versus cmd.exe uses two % character.

In Summary

There are of course more complex differences with the different interpreters that are out of the scope of this document. In general, when you encounter a command example in bash/zsh with the Squirro Toolbox you can easily convert the example to work on Windows, like shown above. And also the other way around.

Another solution are to avoid using the Windows Command line completely.

...

Work remotely on the Squirro server using ssh / putty.

...

Leverage a Bash Interpreter on Windows, e.g GIT Bash https://gitforwindows.org. This one is widely used, and even big corporations and banks allow it typically.

...

Windows Subsystem for Linux WSL https://docs.microsoft.com/en-us/windows/wsl/install-win10. This will be harder in a corporate setting, but allows you to run a full linux subsystem directly on Windows.

...

This page can now be found at Toolbox Differences Between macOS / Linux / Windows on the Squirro Docs site.