Skip to content

Instantly share code, notes, and snippets.

@mataha
Last active July 3, 2024 14:46
Show Gist options
  • Save mataha/f6821c619d653d1194660d36d0a01415 to your computer and use it in GitHub Desktop.
Save mataha/f6821c619d653d1194660d36d0a01415 to your computer and use it in GitHub Desktop.
curl shell test
:<<"#!/bin/sh"
::: curl -fsSL "..." | sh
::: | cmd /d/q/k echo off
@if not "%=^%=" == "%=%=" (set \p=^%<nul) else (set \p=%%<nul)
set last=
for /f delims^= %\p%l in ('^"doskey /history^"') do (set "last=%\p%~l")
if defined last (echo(Last command: "%last%")
echo CMDCMDLINE: '%CMDCMDLINE%'
exit 0
#!/bin/sh
# shellcheck shell=dash
say() {
printf '%s\n' "${*}"
}
die() {
say "error: bootstrap: ${*}"
exit 1
} >&2
main() {
say "Last command: $(history | tail -n1 | sed 's/[0-9]* //')"
}
main "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment