Created
June 17, 2016 00:59
-
-
Save nivekastoreth/03b5424e687cefdd3f79d0acd58bb5ac to your computer and use it in GitHub Desktop.
updated lmgtfy flow
This file contains 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
jmaki@jmaki-pc ~ | |
$ cat piping.sh | |
#!/bin/bash | |
while getopts oe arg; do | |
case "${arg}" in | |
o ) echo >&1 "This is writing to stdout" ;; | |
e ) echo >&2 "This is writing to stderr" ;; | |
* ) ;; # ignore | |
esac | |
done | |
shift $(($OPTIND - 1)) | |
jmaki@jmaki-pc ~ | |
$ ./piping.sh -oee | |
This is writing to stdout | |
This is writing to stderr | |
This is writing to stderr | |
jmaki@jmaki-pc ~ | |
$ cat lmgtfy.sh | |
#!/bin/bash | |
search_string=$(echo "$@" | tr ' ' '+') | |
[ -n "${search_string}" ] && lynx --cookies "https://www.google.com/search?q=${search_string}" | |
jmaki@jmaki-pc ~ | |
$ ./piping.sh -oee 2> >(xargs ./lmgtfy.sh) | |
This is writing to stdout | |
## At this point lynx also opened up with the google search (possibly truncated, not sure) ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment