Created
October 6, 2021 21:08
-
-
Save 0xkarambit/ec59db1fbddbbb8fb658158edbc95fd7 to your computer and use it in GitHub Desktop.
Simple one liner to cheat elegently | cheat.sh aliasing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl "http://cheat.sh/$*" | |
# doesnt work if you use $@ instead of $* | |
# because $* doesnt preserve spaces while $@ does | |
# https://www.shellscript.sh/variables2.html | |
# The first set of variables we will look at are $0 .. $9 and $#. | |
# The variable $0 is the basename of the program as it was called. | |
# $1 .. $9 are the first 9 additional parameters the script was called with. | |
# The variable $@ is all parameters $1 .. whatever. The variable $*, is similar, | |
# but does not preserve any whitespace, and quoting, so "File with spaces" becomes "File" "with" "spaces". This is similar to the echo stuff we looked at in A First Script. As a general rule, use $@ and avoid $*. | |
# $# is the number of parameters the script was called with. | |
# Let's take an example script: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
edit:
-l
flag added to see output inless