Passing CURL a date argument (formatting)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passing CURL a date argument (formatting)
# 1  
Old 04-28-2011
Passing CURL a date argument (formatting)

Im trying to pass curl a list of arguments... one of which is a date... When I run from the command line it works fine but when i try to run the same from a script passing variables it reformats the date for some reason and doesn't work. Example:

curlstring=xxxxxxxxxxx.xxx.xxx:8090/csv/ $curlstring '--data asOfDate="20110427 12:46 GMT"
curl xxxxxxxxxxx.xxx.xxx:8090/csv/ $curlstring
+ curl xxxxxxxxxxx.xxx.xxx:8090/csv/ $curlstring --data asOfDate='"20110427' 12:46 'GMT"'


It for some reason is putting single quotes into the syntax. Variable is created using the following:

AsofDate=`grep AsofDate $PROPERTIES_DIR/1.properties | cut -c 15-`

The working syntax from command line is:

curl xxxxxxxxxxx.xxx.xxx:8090/csv/ $curlstring --data asOfDate="20110427 12:47 GMT"

So the correct syntax is:

asOfDate="20110427 12:47 GMT"

But the script is passing:

asOfDate='"20110427' 12:46 'GMT"'

Why the extra ' marks ?!?!?!?
# 2  
Old 04-28-2011
Quote your date:
Code:
AsofDate="`grep AsofDate $PROPERTIES_DIR/1.properties | cut -c 15-`"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Passing a second argument

I am trying to pass a second argument like so: if ] then export ARG2=$2 else message "Second argument not specified: USAGE - $PROGRAM_NAME ARG1 ARG2" checkerror -e 2 -m "Please specify if it is a history or weekly (H or W) extract in the 2nd argument" fi however, it always goes... (4 Replies)
Discussion started by: MIA651
4 Replies

2. Shell Programming and Scripting

Argument passing

How to pass the alphabet character as a argument in case and in if block? ex: c=$1 if a-z ]] then echo "alphabet" case $1 in a-z) echo "the value is a alphabet" edit by bakunin: please use CODE-tags. We REALLY mean it. (9 Replies)
Discussion started by: Roozo
9 Replies

3. Shell Programming and Scripting

Help with passing argument

Hi, I have a script that is scheduled with cron and runs every night. The cron part looks like this: 00 20 * * 0,1,2,3,4,5,6 /usr/local/bin/BACKUP TBTARM HOT DELETE My issue is with the 3rd parameter. Somewhere in the script, i want to tell the script to delete some files if the 3rd... (7 Replies)
Discussion started by: dollypee
7 Replies

4. Shell Programming and Scripting

Passing variables to cli curl

I have a script that uses cli curl, and it would be easier if it was possible to pass variables like this: curl -c $cookie -d $data www.********.comThis doesn't work, instead I have to generate a string and use eval. Is there another, easier way to pass variables to cli curl? (1 Reply)
Discussion started by: locoroco
1 Replies

5. Shell Programming and Scripting

Recursive argument passing

I'm writing a script that can be called on itself, and must be able to pass arguments down to itself properly. The regular usage of the script is as follows: myfun cmd1 'options1' cmd2 'options2' input If you're interested, the nuts and bolts of this function simply compare the outputs of... (2 Replies)
Discussion started by: Sunlis
2 Replies

6. Shell Programming and Scripting

Passing argument to nawk

Hi all I have got a file digits.data containing the following data 1 3 4 2 4 9 7 3 1 7 3 10 I am writing a script that will pass an argument from C-shell to nawk command. But it seems the values in the nawk comman does not get set. the program does not print no values out. Here is the... (2 Replies)
Discussion started by: ganiel24
2 Replies

7. Shell Programming and Scripting

passing Argument

Hi All, i have script like below.. echo "1) first option" echo "" echo "2) second option" echo "" echo "*) please enter the correct option" read select case $select in 1) echo "first option selected" ;; 2) echo "second option selected" ;; *) echo "please enter the correct... (4 Replies)
Discussion started by: Shahul
4 Replies

8. Shell Programming and Scripting

Problem in argument passing

Hell all, i have a problem in argument passing. print() { a=$1 b=$2 c=$3 echo $a echo $b echo $c } x="1 2 3" y="4 5 6" z="7 8 9" print $x $y $z. (4 Replies)
Discussion started by: tsaravanan
4 Replies

9. Programming

Thread Argument Passing

#include <stdio.h> #include <pthread.h> #define NUM_THREADS 4 /* function to be executed by the new thread*/ void *PrintHello(void * threadid) { printf("\n %3d:Hello World!\n",threadid); pthread_exit(NULL); } int main(int argc, char * argv) { int *taskids; int... (2 Replies)
Discussion started by: narom
2 Replies

10. Shell Programming and Scripting

Passing argument from one script to other

Dear All, I have one script which accepts database name and user_id from the user, i have another script that will unload the data from all the tables based on the user_id accepted by the user. How can i pass the user_id from the 1st script to the other. My OS is sun solaris. Thanks in... (3 Replies)
Discussion started by: lloydnwo
3 Replies
Login or Register to Ask a Question