Perhaps we could specify in the README that apt-get install might install an earlier version; in my case apt-get install is installing version: 0.3.4
Having ancient versions in the Debian repositories should come to now surprise to any Debian user but mentioning it really can't do any harm. It would be great though if shellcheck had its own Debian repo but I guess this would mean a lot of work.
Pretty much true to most distributions with some sense of "stable" to them (debian seem to be very late on the releases even in testing for shellcheck though).
https://github.com/koalaman/shellcheck/releases (0.4.4 is latest)
https://tracker.debian.org/pkg/shellcheck (0.3.7 in testing, unstable and experimental. 0.3.4 in stable)
https://launchpad.net/ubuntu/+source/shellcheck (0.3.7 in latest stable and next release - probably no maintainer just a import from debian)
https://apps.fedoraproject.org/packages/ShellCheck (0.3.7 for fedora 23 and 24)
https://www.archlinux.org/packages/community/x86_64/shellcheck/ (0.4.4 o/)
Pointing fingers at anyone distribution is not very friendly. Describing that packaged versions from distributions will always be behind the git HEAD and so on is on the other hand a good idea.
Since we can't wait for distributions to include the latest version, since it takes ages...
How can we install the latest version (1) without compiling from source and (2) without installing a package manager (ie. cabal)?
I noticed there's a link to download a freshly built binary. Can anyone provide the commands to manually use that binary to do the installation? We could even add those steps to the readme, right @koalaman ?
You just extract and run it. There's no installation.
You're right. I've used these steps to make it globally available:
# Download
wget -P tmp_install_folder/ https://storage.googleapis.com/shellcheck/shellcheck-latest.linux.x86_64.tar.xz
# Extract
tar xvf tmp_install_folder/shellcheck-latest.linux.x86_64.tar.xz -C tmp_install_folder
# Make it globally available
cp tmp_install_folder/shellcheck-latest/shellcheck /usr/bin/shellcheck
# Cleanup
rm -r tmp_install_folder
I think you can close it now.
The @dialex solution above still works, but there are some points that you should note.
The URL to wget should be github.com and not storage.googleapis.com.
https://github.com/koalaman/shellcheck/releases/download/latest/shellcheck-latest.linux.x86_64.tar.xzOtherwise, you'll get the below message.
$ ./shellcheck --version
You are downloading ShellCheck from the wrong URL!
Please update to the latest one:
https://github.com/koalaman/shellcheck/releases/download/latest/shellcheck-latest.linux.x86_64.tar.xz
For more information, see:
https://github.com/koalaman/shellcheck/issues/1871
xzIf you get xz: Cannot exec: No such file or directory while extracting then possibly you are missing the xz-utils package. Most of the Debian-based Docker images don't have it by default.
$ tar xvf shellcheck-latest.linux.x86_64.tar.xz
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
$ tar --version
tar (GNU tar) 1.30
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
$ # Install xz
$ apt-get install xz-utils
...
$ # Extract
$ tar xvf shellcheck-latest.linux.x86_64.tar.xz
shellcheck-latest/README.txt
shellcheck-latest/LICENSE.txt
shellcheck-latest/shellcheck
$ ./shellcheck-latest/shellcheck --version
ShellCheck - shell script analysis tool
version: 0.7.1
license: GNU General Public License, version 3
website: https://www.shellcheck.net
Most helpful comment
You're right. I've used these steps to make it globally available:
I think you can close it now.