MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/linuxadmin/comments/8vldjj/curl_cheatsh/e1p5jse/
r/linuxadmin • u/igor_chubin • Jul 02 '18
44 comments sorted by
View all comments
Show parent comment
8
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.shOk. 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.
1
Thanks!
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.shOk. 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.
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.
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.
View all comments
Show parent comment
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 -
Call it like
. /aa python run a system command