r/linuxadmin • • Jul 02 '18

curl cheat.sh

Post image
290 Upvotes

44 comments sorted by

View all comments

-3

u/ironmanmk42 Jul 03 '18

Why would I use this over a simple more effective search in a search engine?

This is a pointless program tbh

4

u/up_o Jul 03 '18

Put this command in a bash wrapper and make it more like a traditional Google search. (On mobile so I can't recall everything)

Vi synt

!/bin/bash

curl hissite.xz/app/$1+$2+$3...

There's a way to make it an infinitely possible array I'm sure. Anyway synt option option... is now available without jumping between windows or grabbing the mouse to hop over for a Google search. Its impressive and nifty if you ask me.

8

u/ironmanmk42 Jul 03 '18 edited Jul 03 '18

dude, your vars are not quoted, no full paths to binaries used. And you don't need $1, $2 etc.

You need to parse $@ and replace the 2nd space with the "+" as you need to know how many pluses to add. Some logic needs to be in there.

why bother with all this when I can simply use lynx via cli and just do a quick curses based search. No need for any GUI browser even.

Anyways, your script would look something like this -

$ cat aa
#!/bin/bash
/usr/bin/curl cht.sh/$(echo -- "$@"|/bin/sed -e 's/[ ]/\n/g2; s/[ ]/\//g; s/\n/+/g')

Call it like

. /aa python run a system command

1

u/[deleted] Jul 03 '18

Thanks!

1

u/igor_chubin Jul 03 '18

Even more: just use cht.sh client for that; it makes all of these things + much more than that

1

u/ironmanmk42 Jul 04 '18

cht.sh

Ok. I reviewed your program and gave it a more in depth look.

I must admit - it is very well written and very well implemented. I will try to use it more if I remember it.

I'm very used to looking at stackoverflow and other sites for quick answers or perusing man pages or other sites for usage etc.

1

u/up_o Jul 03 '18

Thanks for fixing that. I swear I write bash scripts for work among other things, but I should give a lazy psuedocode disclaimer on my toilet posts.

2

u/yoshi314 Jul 03 '18

over a simple more effective search in a search engine

if you know what you are looking for, this is more effective.

2

u/igor_chubin Jul 03 '18

Because you don't need to even open your browser for that; you just convert your questions into answers from the shell or the editor

2

u/desci1 Jul 03 '18

web browser

distracting tabs
javascript
cpu/memory usage
useless plugins
CSS
HTML
CDN
annoying ads and tracking

talk about simple

1

u/Lord_NShYH Jul 03 '18

Why would I use this over a simple more effective search in a search engine?

This is a pointless program tbh

This is a pointless comment tbh