ShellCheck


finds bugs in your shell scripts.
You can cabal, apt, dnf, pkg or brew install it locally right now.
Paste a script to try it out:
📄
Your Editor (Ace – loading 800kb of JS)
 
#!/bin/bash
# Return last file in dir
last_offset=1
cmd=
if [[ "$#" -gt 0 ]]; then
	if [[ "$1" =~ ^[0-9]+$ ]]; then
		last_offset="$1"
		shift
	else
		if which "$1"; then
			cmd="$1"
			shift
		fi
	fi
fi
fn="$(ls -rt "$@" | tail -"$last_offset" | head -1 | sed -e 's/ /\\ /g')"
if [[ ! -f "$fn" ]]; then
	echo "lastf returned an entry that is not an actual file: $fn" >&2
fi
if [[ "$cmd" != '' ]]; then
	"$cmd" "$fn"
else
	printf '%s\n' "$fn"
fi
📄
ShellCheck Output
If you paste a script in the editor above, this window will show shellcheck output.

ShellCheck is...

A special thanks to the GitHub Sponsors: benliddicottGitpodaniravi24per1234BashSupport Pro per1234WhitewaterFoundryreap2sow1dcminterphotostructureCronitordevholicqmacroani-clicodiga.ioSnapShooter Backups

Wiki Sitemap