LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-07-2006, 03:11 AM   #1
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 3,025

Rep: Reputation: 538Reputation: 538Reputation: 538Reputation: 538Reputation: 538Reputation: 538
Arrow Need shell script to concatenate a string and a variable into a directory name


I want to write a shell script that uses wget to retrieve only certain directories from my webserver. I don't know shell scripting at all, but I'll write something that will give you an idea of what I want:

#!/bin/bash

declare variable int = 1

declare variable str = '000'

begin

wget -l 1 http://www.domain.com/directory/xyz+...z0001orxyz0002

increment int +1

if int > 9 and int < 100

str = '00'

else if int > 99 and int < 1000

str = '0'

else if int > 999 and int < 10,000

str = ''

else

end

loop

exit 0

**end script**

So I want to go through directories xyz0001 thru directory xyz9999
 
Old 05-07-2006, 03:32 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
that's pretty confusing what you want to achieve, unless it's a lot lot simpler than you make out. seems you want to grab everything under xyz0001 to xyz9999 yeah? that's a doddle, no script needed there...

curl http://domain.com/directory/xyz[0001-9999]
 
Old 05-07-2006, 03:42 AM   #3
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 3,025

Original Poster
Rep: Reputation: 538Reputation: 538Reputation: 538Reputation: 538Reputation: 538Reputation: 538
Smile Thanks

I'll try it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
String Tokenizing in shell script Reegz Linux - Newbie 14 04-26-2006 04:07 PM
Shell script to find a particular string Prasun1 Linux - General 5 08-30-2005 09:23 AM
[Bash] Concatenate string using awk senorsnor Programming 7 05-05-2005 12:38 AM
PL/PGSQL - String concatenate problem jaunine Linux - Software 7 03-18-2005 07:11 AM
how to concatenate variable name in Java ? black Programming 1 11-16-2004 04:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration