![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| while loop inside while loop | panknil | Shell Programming and Scripting | 0 | 01-07-2008 12:49 PM |
| For loop | xramm | HP-UX | 3 | 10-10-2007 03:20 PM |
| While Loop | hemangjani | Shell Programming and Scripting | 2 | 11-02-2006 11:01 AM |
| for loop | munnabhai1 | Shell Programming and Scripting | 3 | 04-06-2006 03:30 PM |
| how to get the similar function in while loop or for loop | trynew | Shell Programming and Scripting | 3 | 06-17-2002 12:09 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
cat and loop
Hi I have a simple code that I want to execute. Code:
out=out.txt for f in `cat list.txt | head -1`; do echo $f >> $out echo "sleep 5" >> $out done cat list.txt | head -1 wget -q -O - 'http://test.com:15100/cgi-bin/search cat out.txt wget sleep 5 -q sleep 5 -O sleep 5 - sleep 5 'http://test.com:15100/cgi-bin/search' sleep 5 The problem is list.txt contains spaces and they are treated as separator. My ideal output is of course to show wget -q -O - 'http://test.com:15100/cgi-bin/search' sleep 5 Any smart way to do this preferably using less code. |
|
||||
|
Just to deviate as little as possible from your original, Code:
head -1 list.txt >>$out # yes, the cat is completely meaningless echo sleep 5 >>$out If you actually need to get the output into backticks, take care to quote properly. Code:
string_with_spaces="`head -1 list.txt`" |
|
||||
|
Granted, the quotes are unnecessary in this context -- I didn't want to go back to the useless for loop just to explain the issue, so I made a rather inexact statement instead. Humor me.
Looks like ohagar already posted an identical suggestion -- sorry, missed that somehow before. Anyway, I believe there is an option in wget itself to wait a specified number of seconds between retrieving two URLs, so the whole question seems kind of ... intriguing. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|