Skip to content

Instantly share code, notes, and snippets.

@lynsei
Created May 31, 2022 07:50
Show Gist options
  • Save lynsei/7846cbc5855f44c5be81c34d53acc2f0 to your computer and use it in GitHub Desktop.
Save lynsei/7846cbc5855f44c5be81c34d53acc2f0 to your computer and use it in GitHub Desktop.
# lyns lang [superset of fish]
#
# replace the output of npm pkg get as commands and generate an array from them:
set -e n && npm pkg get cmds | \
head -n-1 | \
tail -n +2 | \
while read -at i; \
set n "$n""$i"\n; \
end && \
echo -n $n | \
string replace ',' ''
# or simply:
set -e n && npm pkg get cmds | head -n-1 | tail -n +2 | while read -at i; set n "$n""$i"\n; end && echo -n $n | string replace ',' ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment