Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nivekastoreth/03b5424e687cefdd3f79d0acd58bb5ac to your computer and use it in GitHub Desktop.
Save nivekastoreth/03b5424e687cefdd3f79d0acd58bb5ac to your computer and use it in GitHub Desktop.
updated lmgtfy flow
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