File from wget in script not available for next command

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am wget-ing a file and to preserve its original file name i do a find for its known extension.



Everything is working fine on the terminal but in a script the file is never available/there for the find command.



I guess after wget completes the download the file is not yet persisted to the file system ...



How can I wait for the file to be available?



wget -q -N "$BASEURL/$VERSION"
echo $(find . -maxdepth 1 -name *.jar)






share|improve this question






















  • First, I'd use the -O option to specify a file path/name to output to - this way, you skip the find step. If the file really isn't there until wget has finally finished, then adding a sleep 3 (or however many seconds you want) after the wget and before your next command(s) should do it. Be sure to quote the url you are wget-ing in case it has ampersands, etc. in it (which would send wget to the background and let the script continue, which means the file wouldn't be totally there)
    – ivanivan
    Mar 6 at 13:20










  • sleep is working but very ugly, I don't want -O because I want to preserve its original name and the files are behind redirects
    – Pali
    Mar 6 at 13:22










  • Can you please paste the script which you tried so far?
    – Thushi
    Mar 6 at 13:25










  • @Thushi updated q
    – Pali
    Mar 6 at 13:36










  • #!/bin/sh wget -q -N google.com echo $(find . -maxdepth 1 -name *.html) This works for me! Can you please paste the error text which you are getting?
    – Thushi
    Mar 7 at 11:56














up vote
0
down vote

favorite












I am wget-ing a file and to preserve its original file name i do a find for its known extension.



Everything is working fine on the terminal but in a script the file is never available/there for the find command.



I guess after wget completes the download the file is not yet persisted to the file system ...



How can I wait for the file to be available?



wget -q -N "$BASEURL/$VERSION"
echo $(find . -maxdepth 1 -name *.jar)






share|improve this question






















  • First, I'd use the -O option to specify a file path/name to output to - this way, you skip the find step. If the file really isn't there until wget has finally finished, then adding a sleep 3 (or however many seconds you want) after the wget and before your next command(s) should do it. Be sure to quote the url you are wget-ing in case it has ampersands, etc. in it (which would send wget to the background and let the script continue, which means the file wouldn't be totally there)
    – ivanivan
    Mar 6 at 13:20










  • sleep is working but very ugly, I don't want -O because I want to preserve its original name and the files are behind redirects
    – Pali
    Mar 6 at 13:22










  • Can you please paste the script which you tried so far?
    – Thushi
    Mar 6 at 13:25










  • @Thushi updated q
    – Pali
    Mar 6 at 13:36










  • #!/bin/sh wget -q -N google.com echo $(find . -maxdepth 1 -name *.html) This works for me! Can you please paste the error text which you are getting?
    – Thushi
    Mar 7 at 11:56












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am wget-ing a file and to preserve its original file name i do a find for its known extension.



Everything is working fine on the terminal but in a script the file is never available/there for the find command.



I guess after wget completes the download the file is not yet persisted to the file system ...



How can I wait for the file to be available?



wget -q -N "$BASEURL/$VERSION"
echo $(find . -maxdepth 1 -name *.jar)






share|improve this question














I am wget-ing a file and to preserve its original file name i do a find for its known extension.



Everything is working fine on the terminal but in a script the file is never available/there for the find command.



I guess after wget completes the download the file is not yet persisted to the file system ...



How can I wait for the file to be available?



wget -q -N "$BASEURL/$VERSION"
echo $(find . -maxdepth 1 -name *.jar)








share|improve this question













share|improve this question




share|improve this question








edited Mar 6 at 13:36

























asked Mar 6 at 13:12









Pali

1012




1012











  • First, I'd use the -O option to specify a file path/name to output to - this way, you skip the find step. If the file really isn't there until wget has finally finished, then adding a sleep 3 (or however many seconds you want) after the wget and before your next command(s) should do it. Be sure to quote the url you are wget-ing in case it has ampersands, etc. in it (which would send wget to the background and let the script continue, which means the file wouldn't be totally there)
    – ivanivan
    Mar 6 at 13:20










  • sleep is working but very ugly, I don't want -O because I want to preserve its original name and the files are behind redirects
    – Pali
    Mar 6 at 13:22










  • Can you please paste the script which you tried so far?
    – Thushi
    Mar 6 at 13:25










  • @Thushi updated q
    – Pali
    Mar 6 at 13:36










  • #!/bin/sh wget -q -N google.com echo $(find . -maxdepth 1 -name *.html) This works for me! Can you please paste the error text which you are getting?
    – Thushi
    Mar 7 at 11:56
















  • First, I'd use the -O option to specify a file path/name to output to - this way, you skip the find step. If the file really isn't there until wget has finally finished, then adding a sleep 3 (or however many seconds you want) after the wget and before your next command(s) should do it. Be sure to quote the url you are wget-ing in case it has ampersands, etc. in it (which would send wget to the background and let the script continue, which means the file wouldn't be totally there)
    – ivanivan
    Mar 6 at 13:20










  • sleep is working but very ugly, I don't want -O because I want to preserve its original name and the files are behind redirects
    – Pali
    Mar 6 at 13:22










  • Can you please paste the script which you tried so far?
    – Thushi
    Mar 6 at 13:25










  • @Thushi updated q
    – Pali
    Mar 6 at 13:36










  • #!/bin/sh wget -q -N google.com echo $(find . -maxdepth 1 -name *.html) This works for me! Can you please paste the error text which you are getting?
    – Thushi
    Mar 7 at 11:56















First, I'd use the -O option to specify a file path/name to output to - this way, you skip the find step. If the file really isn't there until wget has finally finished, then adding a sleep 3 (or however many seconds you want) after the wget and before your next command(s) should do it. Be sure to quote the url you are wget-ing in case it has ampersands, etc. in it (which would send wget to the background and let the script continue, which means the file wouldn't be totally there)
– ivanivan
Mar 6 at 13:20




First, I'd use the -O option to specify a file path/name to output to - this way, you skip the find step. If the file really isn't there until wget has finally finished, then adding a sleep 3 (or however many seconds you want) after the wget and before your next command(s) should do it. Be sure to quote the url you are wget-ing in case it has ampersands, etc. in it (which would send wget to the background and let the script continue, which means the file wouldn't be totally there)
– ivanivan
Mar 6 at 13:20












sleep is working but very ugly, I don't want -O because I want to preserve its original name and the files are behind redirects
– Pali
Mar 6 at 13:22




sleep is working but very ugly, I don't want -O because I want to preserve its original name and the files are behind redirects
– Pali
Mar 6 at 13:22












Can you please paste the script which you tried so far?
– Thushi
Mar 6 at 13:25




Can you please paste the script which you tried so far?
– Thushi
Mar 6 at 13:25












@Thushi updated q
– Pali
Mar 6 at 13:36




@Thushi updated q
– Pali
Mar 6 at 13:36












#!/bin/sh wget -q -N google.com echo $(find . -maxdepth 1 -name *.html) This works for me! Can you please paste the error text which you are getting?
– Thushi
Mar 7 at 11:56




#!/bin/sh wget -q -N google.com echo $(find . -maxdepth 1 -name *.html) This works for me! Can you please paste the error text which you are getting?
– Thushi
Mar 7 at 11:56















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428506%2ffile-from-wget-in-script-not-available-for-next-command%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428506%2ffile-from-wget-in-script-not-available-for-next-command%23new-answer', 'question_page');

);

Post as a guest













































































aQiquq9H,L49VDgDSwGrG,N76sCa6o37y34 kHInMMbIoBLEkh,VJcPLh,KiMaWR9VFSc,MbX5G3SskIJDOr8VH
Mpw0i5OBBqr2Q7VB857tBH Xo e2taI5IaT2MUDiPN14mWLyNQytARJ

Popular posts from this blog

How to check contact read email or not when send email to Individual?

How many registers does an x86_64 CPU actually have?

Displaying single band from multi-band raster using QGIS