I guessed that you folks would want some "code o' my own," so I wrote some.
Did some double-checking on the rules of parameter extraction -- last time I did anything of the kind was in AppleScript three or four years ago.
So here's my script as it stands now. The echos about a correctly-formatted web address are the ones I intend to replace with the cUrl commands.
I'm taking this one step at a time. I have the function ready, allowing for some substitution of commands. Thanks for the "while true" hint. I'll add your && echo "$NAME" "$LINK" > file.log code later on.
BZT
---------- Post updated 27th Feb 2010 at 13:54 ---------- Previous update was 26th Feb 2010 at 22:42 ----------
Still a little wary of applying the "while true" loop, I made some modifications to the script as last posted, dressing up the output to the log file and making sure that the exit commands were working.
But by avoiding the "while true" loop to this point, I may have hung myself by my own petard, as now, predictably, every time the script is run it creates a new log file with a new date & time as part of the name.
I like the kind of output I'm getting, nicely formatted etc.:
But it looks like I'll have to "dive into the while pool" to make these into real log files instead of "results" redirects with a single string of output to them. Which is not what I meant for them to be.
Would anyone advise abandoning the function part and just bulldozing through, beginning to end, with what I have now? Does that tend to work better when while loops are applied to scripts like this? Or am I asking two incompatible questions?
BZT
My complete script as of this post time:
Last edited by SilversleevesX; 02-26-2010 at 11:46 PM..
Reason: Didn't fully read the reply I was replying to.
Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts..
I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
I had the idea come into my head that it would be good to have a single command that gave file type, file size, last modification date, and owner/group information, like what one would see in a GUI "Properties" dialog, but all in a terminal window. In my opinion, these statistics about a file... (5 Replies)
I'm running a curl command in bash, but the & in the middle causes the second half of the line to run in the background, here's what I'm trying to do:
lat="37.451"
lon="-122.18"
url="http://ws.geonames.org/findNearestAddress?lat=$lat&lng=$lon"
curl -s "$url"
I tried escaping the & with \&,... (4 Replies)
Hello experts!
I have a file1 with the following format (yr,day, month, hour,minute):
201201132435
201202141210
201304132030
201410100110
...
What i want to do is to assign variables and then use them in the curl command to download the text of each event from a web page.
What I have... (6 Replies)
On RHEL5 from within both a shell (sh->bash) and a csh script curl fails with a "curl: (6) Couldn't resolve host 'application'" error.
This is the result whether run as a command at the shell and/or c-shell prompt and curl also fails with the same error when the scripts are "source'd" at the... (5 Replies)
I am trying to use REST API and curl in a bash script to generate a http report. The curl command at the end of the script should generate a html file but instead I get an error "HTTP/1.1 503 Service Unavailable".
This is the script
#!/bin/bash
export... (7 Replies)
Hello.
I have pick up a script from internet to track errors from curl command.
#!/bin/bash
#
URL_TO_TEST="http://www.xxxxxx.yyy"
MY_VAR=curl_init("$URL_TO_TEST") ;
curl_setopt($MY_VAR, CURLOPT_HEADER, 1);
curl_setopt($MY_VAR, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($MY_VAR,... (2 Replies)
Hello Experts ,
I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here.
Here is my use case to run on bash shell
1. Access an URL -- in script , it will be mentioned as inputURL
2. Once i accessed the URL... (1 Reply)
Hello,
My question is about curl command. (ubuntu14.04)
In terminal, I am able to download my mainfile with:
curl -u user1:pass1 http://11.22.33.44/*******
When I convert it into bash script like this:
#!/bin/bash
cd /root/scripts
computer_ip=11.22.33.44
curl -u $1:$2... (8 Replies)