Académique Documents
Professionnel Documents
Culture Documents
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up
4 First you need to set the user agent so google will authorize output from searches. Then we can look 0 Is it possible to show
for images and select the desired one. To accomplish that we insert missing newlines, wget will return interactive shell command
output on a webpage
google searches on one single line, and filter the link. The index of the file is stored in the variable without refreshing the
count . webpage?
converted by W eb2PDFConvert.com
Better code Do I need to apologize in my
rejection email for not picking up a
The problem with this code is that it returns pictures in low resolution. A better solution is as follows: phone call from an employer I
applied to?
#! /bin/bash What is a state in physics?
# function to create all dirs til file can be made Is there a visual equivalent of the
function mkdirs { word "overhear"?
file="$1"
dir="/" How was Palpatine able to rise
through the Senate so quickly to
# convert to full path become chancellor?
if [ "${file##/*}" ]; then How to make dining alone less
file="${PWD}/${file}" awkward?
fi
"He is 80 years young"
# dir name of following dir One word for "put something to a
next="${file#/}" lower form/level/grade"
# while not filename Passive construction "have been
while [ "${next//[^\/]/}" ]; do explained": is it okay to say ""I have
# create dir if doesn't exist been explained this problem
[ -d "${dir}" ] || mkdir "${dir}" several times"?
dir="${dir}/${next%%/*}" Cos' un "babaccetto"?
next="${next#*/}"
done Constant Pressure from Advisor -
How to Stay Motivated?
# last directory to make
How would a resourceful
[ -d "${dir}" ] || mkdir "${dir}" government block Tor?
}
What's more efficient: lightened
# get optional 'o' flag, this will open the image after download armor or pocketed armor?
getopts 'o' option
Some basic questions regarding
[[ $option = 'o' ]] && shift rank-1 matrices,
# parse arguments Find the nth Fibohexaprime
count=${1}
shift
query="$@"
[ -z "$query" ] && exit 1 # insufficient arguments
# set default
Example usage:save location and file name change this!!
dir="$PWD"
file="google image"
$ chmod +x getimg.sh
$ ./getimg.sh 1 dog
#$ get optionalgoogle_image.jpg
gnome-open second argument, which defines the file name or dir
if [[ $# -eq 2-o]];10then
$ ./getimg.sh donkey
if [ -d "$2" ]; then
dir="$2"
shareelse
improve this answer edited May 30 at 3:34 answered Jan 12 at 20:18
file="${2}"
mkdirs "${dir}"
dir="" ShellFish
fi 3,026 1 8 24
fi
converted by W eb2PDFConvert.com
1 @tom My pleasure, check out the script too! ShellFish Jan 12 at 20:29
1 I'll look into it. ShellFish Jan 12 at 20:34
1 I'm afraid google doesn't supply a link to the original image in their website code. It must be javascript that
handle's linking to the original image. If you can find it in google's code (using a browser's "inspect element")
I'll be happy to take care of it. ShellFish Jan 12 at 20:50
1 I was mistaken, I will look into it. ShellFish Jan 12 at 21:14
1 The script should now take a second argument, which is either a target dir (where it will save the image as
"google image.ext" or "google image(1).ext" etc if the file already exists. You can also supply a file name as
second argument such as /home/user/Documents/images/image . The extension will be added
automatically. -- Let me kniw if there are bugs. ShellFish May 28 at 23:28
Your Answer
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged linux shell web or ask your own
question.
question feed
tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback
converted by W eb2PDFConvert.com
Stack Overflow Programmers Database Photography English Language & Mathematics Stack Apps
Administrators Usage
Server Fault Unix & Linux Science Fiction & Cross Validated (stats) Meta Stack Exchange
Drupal Answers Fantasy Skeptics
Super User Ask Different (Apple) Theoretical Computer Area 51
SharePoint Graphic Design Mi Yodeya (Judaism) Science
Web Applications WordPress Stack Overflow
Development User Experience Movies & TV Travel Physics Careers
Ask Ubuntu
Geographic Mathematica Seasoned Advice Christianity MathOverflow
Webmasters Information Systems (cooking)
Salesforce Arqade (gaming) Chemistry
Game Development Electrical Engineering Home Improvement
ExpressionEngine Bicycles Biology
TeX - LaTeX Android Enthusiasts Answers Personal Finance &
Money Role-playing Games more (5)
Information Security more (13)
Academia more (21)
more (9)
site design / logo 2015 Stack Exchange Inc; user contributions licensed under cc by-sa 3.0 with attribution required
rev 2015.12.11.3072
converted by W eb2PDFConvert.com