Sponsored Content
Full Discussion: Using curl in bash script
Top Forums Shell Programming and Scripting Using curl in bash script Post 303008784 by jcdole on Wednesday 6th of December 2017 06:02:33 AM
Old 12-06-2017
Thank you very much for your help.
Quote:
Originally Posted by Yoda
curl return error codes. Here is a manual page that includes most of the error codes.

So you can run a curl command and look at the exit code to get the status:-
Code:
$ curl https://domain.com 2> /dev/null

$ print $?
7

Thank you very much for your help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script idea using cUrl -- possible?

I have an alias already in my .bash_profile to download files using cUrl's -o (output to file, user provides the file name) option. I find I'm using it quite a bit, so I wanted to write a script to run "curl -o", taking the necessary inputs - file name and URL from which to download - and then... (3 Replies)
Discussion started by: SilversleevesX
3 Replies

2. Shell Programming and Scripting

using curl in a script

Hello everyone I'm currently using a script to upload files (different file names, but same date) to an ftp server (see below) #!/bin/sh # Set the variables HOST=<host> USER=<user> PASSWD=<password> ftp -i -n $HOST <<END_SCRIPT user ${USER} ${PASSWD} mput... (0 Replies)
Discussion started by: soliberus
0 Replies

3. Shell Programming and Scripting

bash curl escape & in url

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)
Discussion started by: unclecameron
4 Replies

4. Shell Programming and Scripting

Using CURL in a script

Hi all so I'm new to scripting but I am making a script that is a url shortener. It will take a url off the command line and spit back the shortened version using bit.ly's api this is what I have so far if then echo "You must supply a URL." exit 1 fi read url... (3 Replies)
Discussion started by: subway69
3 Replies

5. Shell Programming and Scripting

Sending awk variables into curl in a bash script

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)
Discussion started by: phaethon
6 Replies

6. Shell Programming and Scripting

Curl/http 503 error with bash script

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)
Discussion started by: kieranfoley
7 Replies

7. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

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)
Discussion started by: radha254
1 Replies

8. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

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... (5 Replies)
Discussion started by: radha254
5 Replies

9. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

10. Shell Programming and Scripting

Curl , download file with user:pass in bash script

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)
Discussion started by: baris35
8 Replies
CURLOPT_PATH_AS_IS(3)					     curl_easy_setopt options					     CURLOPT_PATH_AS_IS(3)

NAME
CURLOPT_PATH_AS_IS - do not handle dot dot sequences SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PATH_AS_IS, long leaveit); DESCRIPTION
Set the long leaveit to 1, to explicitly tell libcurl to not alter the given path before passing it on to the server. This instructs libcurl to NOT squash sequences of "/../" or "/./" that may exist in the URL's path part and that is supposed to be removed according to RFC 3986 section 5.2.4. Some server implementations are known to (erroneously) require the dot dot sequences to remain in the path and some clients want to pass these on in order to try out server implementations. By default libcurl will merge such sequences before using the path. DEFAULT
0 PROTOCOLS
All EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/../../etc/password"); curl_easy_setopt(curl, CURLOPT_PATH_AS_IS, 1L); curl_easy_perform(curl); } AVAILABILITY
Aded in 7.42.0 RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. SEE ALSO
CURLOPT_STDERR(3), CURLOPT_DEBUGFUNCTION(3), CURLOPT_URL(3), libcurl 7.54.0 February 14, 2016 CURLOPT_PATH_AS_IS(3)
All times are GMT -4. The time now is 01:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy