curl delete command woint work in scripted for loopCURL command executionHow to use SFTP on a system that...

A* pathfinding algorithm too slow

How does mmorpg store data?

Did the Russian Empire have a claim to Sweden? Was there ever a time where they could have pursued it?

Can I submit a paper to two or more journals at the same time?

Having to constantly redo everything because I don't know how to do it

"I am [the / an] owner of a bookstore"?

How useful would a hydroelectric power plant be in the post-apocalypse world?

Can dual citizens open crypto exchange accounts where U.S. citizens are prohibited?

Why are examinees often not allowed to leave during the start and end of an exam?

Checkmate in 1 on a Tangled Board

Why are symbols not written in words?

Perform mirror symmetry transformation of 3D model (in OBJ)

Can I take Amul cottage cheese from India to Netherlands?

Robots in a spaceship

What was the point of separating stdout and stderr?

Rear derailleur got caught in the spokes, what could be a root cause

Equatorial oceanic river caused by tides

Is it advisable to inform the CEO about his brother accessing his office?

Delete all files from a folder using a bat that match a certain pattern in Windows 10

What verb for taking advantage fits in "I don't want to ________ on the friendship"?

How can an inexperienced GM keep a game fun for experienced players?

Word ending in "-ine" for rat-like

Is my guitar action too high or is the bridge too high?

Does friction always oppose motion?



curl delete command woint work in scripted for loop


CURL command executionHow to use SFTP on a system that requires sudo for root access & ssh key based authentication?curl url call in for loop?cURL for loop variableUnable to download data using curl for loopCan't SSH into localhostRun time for curl commandSSH Configuration Help / Can't tunnelDisable Root Password Login… but can I SUDO with a GUI SFTP program?curl doesn't work in bash loop













0















Is there any reason why a curl command wont work with variables?



Here is my set up - I am not using real values as I can not expose client data and I have no test environment



You will notice that I am using two curl commands, yes I know it can be combined into one command, but I haven't been able to make that work so I am splitting then up unto two separate commands to test with.



Here I set up the paths for inbound folder on my system:



[root@acme logs]# act="roadrunner"
[root@acme logs]# content="xml"
[root@acme logs]# inbndfldr='/ftp/'"$act"'/inbound'
[root@acme logs]# destinationFolder="$inbndfldr"/"$content"/
[root@acme logs]# logFolder="$inbndfldr"/logs


Here I set up the paths for outbound folder on the remote system:



[root@acme logs]# targetHost="SFTP://welcometotheroad.net"
[root@acme logs]# THFolderName="OUTBOUND"
[root@acme logs]# THFolder='/'"$THFolderName"
[root@acme logs]# THSftpAddress=$targetHost$THFolder
[root@acme logs]# THDeleteSftpAddress=$targetHost$THFolder'/'


Here I set up authentication on the remote system:



[root@acme logs]# username=mrRoadRunner
[root@acme logs]# password=Beep-8eep!
[root@acme logs]# sessionAuthentication="$username":"$password"


Here I set the file reference:



[root@acme logs]# fileref="openroad2019.xml"


Here I verify that the file exists on the remote server:



[root@acme logs]# THFiles=$(curl -sSk -u $sessionAuthentication $THSftpAddress | grep $fileref | awk '{print $9}')
[root@acme logs]# echo $THFiles
[root@acme logs]# openroad2019.xml


Here I begin my loop:



[root@acme logs]# for targetFile in $THFiles
> do
> dateTimeStamp=`date +%Y%m%d%H%M%S`
> traceLog="$logFolder"/"$targetFile"trace"$dateTimeStamp".log
> testLog="$logFolder"/test"$dateTimeStamp".log
> deltraceLog="$logFolder"/del"$targetFile"trace"$dateTimeStamp".log
> deltestLog="$logFolder"/deltest"$dateTimeStamp".log
> deleteString='"-rm '"$THFolderName"'/'"$targetFile"'"'
> masterGetStr=`echo curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>>"$testLog" 2>&1`
> masterDeleteStr=`echo curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1`
> echo
> echo -----
> echo "$masterGetStr"
> echo --
> echo "$masterDeleteStr"
> echo -----
> echo
> curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>> "$testLog" 2>&1
> curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1
> done


Here is the output:



-----
curl -k --trace /ftp/roadrunner/inbound/logs/openroad2019.xmltrace20190628180349.log --user mrRoadRunner:Beep-8eep! -O SFTP://welcometotheroad.net/OUTBOUND/openroad2019.xml --ftp-ssl &>>/ftp/roadrunner/inbound/logs/test20190628180349.log 2>&1
--
curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1
-----


The first curl command works just fine, drops the file right where I need it.



The second curl command is supposed to delete the file on the remote system and it is not working. Here I view the logs on that:



::::::::::::::
delopenroad2019.xmltrace20190628180349.log
::::::::::::::
== Info: Trying 0.0.0.0...
== Info: TCP_NODELAY set
== Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
== Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
== Info: SSH authentication methods available: publickey,password
== Info: Using SSH private key file '/root/.ssh/id_rsa'
== Info: SSH public key authentication failed: Username/PublicKey combination invalid
== Info: Initialized password authentication
== Info: Authentication complete
== Info: Sending quote commands
== Info: Syntax error in SFTP command. Supply parameter(s)!
== Info: Connection #0 to host welcometotheroad.net left intact
== Info: getaddrinfo(3) failed for OUTBOUND:80
== Info: Couldn't resolve host 'OUTBOUND'
== Info: Closing connection 1
::::::::::::::
deltest20190628180349.log
::::::::::::::
curl: (21) Syntax error in SFTP command. Supply parameter(s)!
curl: (6) Couldn't resolve host 'OUTBOUND'
::::::::::::::
test20190628180349.log
::::::::::::::
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4290 100 4290 0 0 3248 0 0:00:01 0:00:01 --:--:-- 3252
100 4290 100 4290 0 0 3247 0 0:00:01 0:00:01 --:--:-- 3247
[root@acme logs]#


Yet, when I type in the command manually - it works and deletes the file off the remote system.



curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1

[root@rh1 logs]# more *20190628180546*.log

::::::::::::::
openroad2019.xmltrace20190628180546.log
::::::::::::::
Info: Trying 0.0.0.0...
== Info: TCP_NODELAY set
== Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
== Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
== Info: SSH authentication methods available: publickey,password
== Info: Using SSH private key file '/root/.ssh/id_rsa'
== Info: SSH public key authentication failed: Username/PublicKey combination invalid
== Info: Initialized password authentication
== Info: Authentication complete
<= Recv data, 2000 bytes (0x7d0)
0000: ef bb bf 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e ...<?xml version
...
... (details removed)
...
0110: 6e 73 74 72 75 63 74 69 6f 6e 73 48 65 61 64 65 nstructionsHeade
0120: 72 3e r>
== Info: Connection #0 to host welcometotheroad.net left intact

::::::::::::::
del_openroad2019.xmltrace20190628180546.log
::::::::::::::
== Info: Trying 0.0.0.0...
== Info: TCP_NODELAY set
== Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
== Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
== Info: SSH authentication methods available: publickey,password
== Info: Using SSH private key file '/root/.ssh/id_rsa'
== Info: SSH public key authentication failed: Username/PublicKey combination invalid
== Info: Initialized password authentication
== Info: Authentication complete
=> Send data, 55 bytes (0x37)
0000: 64 72 77 78 72 2d 78 2d 2d 2d 20 32 20 66 74 70 drwxr-x--- 2 ftp
0010: 61 64 6d 69 6e 20 66 74 70 61 64 6d 69 6e 20 20 admin ftpadmin
...
... (details removed)
...
0050: 30 30 2d 32 36 37 36 39 36 37 33 5f 44 49 5f 4c 00-26769673_DI_L
0060: 45 30 2e 58 4d 4c 0a E0.XML.
== Info: Sending quote commands
== Info: Connection #0 to host welcometotheroad.net left intact

::::::::::::::
delopenroad2019.xmltrace20190628180546.log
::::::::::::::
== Info: Trying 0.0.0.0...
== Info: TCP_NODELAY set
== Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
== Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
== Info: SSH authentication methods available: publickey,password
== Info: Using SSH private key file '/root/.ssh/id_rsa'
== Info: SSH public key authentication failed: Username/PublicKey combination invalid
== Info: Initialized password authentication
== Info: Authentication complete
== Info: Sending quote commands
== Info: Syntax error in SFTP command. Supply parameter(s)!
== Info: Connection #0 to host welcometotheroad.net left intact
== Info: getaddrinfo(3) failed for OUTBOUND:80
== Info: Couldn't resolve host 'OUTBOUND'
== Info: Closing connection 1

::::::::::::::
del_test20190628180546.log
::::::::::::::
drwxr-x--- 2 ftpadmin ftpadmin 0 Jun 28 23:38 .
drwxr-x--- 2 ftpadmin ftpadmin 0 Apr 26 2019 ..
-rwxr-x--- 1 ftpadmin ftpadmin 7780 Jun 27 14:36 NextFile20190620172738.XML
-rwxr-x--- 1 ftpadmin ftpadmin 2440 Jun 27 14:36 NextFile20190620172740.XML
-rwxr-x--- 1 ftpadmin ftpadmin 7980 Jun 27 14:36 NextFile20190624111531.XML
-rwxr-x--- 1 ftpadmin ftpadmin 2441 Jun 27 14:36 NextFile20190624111533.XML
-rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 14:36 NextFile20190626165728.XML
-rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 14:36 NextFile20190626165729.XML
-rwxr-x--- 1 ftpadmin ftpadmin 15424 Jun 27 14:36 NextFile20190627091426.XML
-rwxr-x--- 1 ftpadmin ftpadmin 4104 Jun 27 14:37 NextFile20190627091427.XML
-rwxr-x--- 1 ftpadmin ftpadmin 10417 Jun 27 14:37 NextFile20190627092525.XML
-rwxr-x--- 1 ftpadmin ftpadmin 3071 Jun 27 14:37 NextFile20190627092527.XML
-rwxr-x--- 1 ftpadmin ftpadmin 15594 Jun 27 14:37 NextFile20190627093345.XML
-rwxr-x--- 1 ftpadmin ftpadmin 4279 Jun 27 14:37 NextFile20190627093347.XML
-rwxr-x--- 1 ftpadmin ftpadmin 17237 Jun 27 14:37 NextFile20190627094528.XML
-rwxr-x--- 1 ftpadmin ftpadmin 4290 Jun 27 14:37 NextFile20190627094530.XML
-rwxr-x--- 1 ftpadmin ftpadmin 15608 Jun 27 14:37 NextFile20190627100222.XML
-rwxr-x--- 1 ftpadmin ftpadmin 4288 Jun 27 14:37 NextFile20190627100224.XML
-rwxr-x--- 1 ftpadmin ftpadmin 2455 Jun 27 14:37 NextFile20190627102026.XML
-rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 15:18 NextFile20190627111647.XML
-rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 15:18 NextFile20190627111648.XML
-rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 18:56 NextFile20190627145327.XML
-rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 18:56 NextFile20190627145328.XML
-rwxr-x--- 1 ftpadmin ftpadmin 12797 Jun 27 20:08 NextFile20190627160344.XML
-rwxr-x--- 1 ftpadmin ftpadmin 3609 Jun 27 20:08 NextFile20190627160345.XML


My question is "WHY WONT IT WORK IN THE FOR LOOP?"










share|improve this question





























    0















    Is there any reason why a curl command wont work with variables?



    Here is my set up - I am not using real values as I can not expose client data and I have no test environment



    You will notice that I am using two curl commands, yes I know it can be combined into one command, but I haven't been able to make that work so I am splitting then up unto two separate commands to test with.



    Here I set up the paths for inbound folder on my system:



    [root@acme logs]# act="roadrunner"
    [root@acme logs]# content="xml"
    [root@acme logs]# inbndfldr='/ftp/'"$act"'/inbound'
    [root@acme logs]# destinationFolder="$inbndfldr"/"$content"/
    [root@acme logs]# logFolder="$inbndfldr"/logs


    Here I set up the paths for outbound folder on the remote system:



    [root@acme logs]# targetHost="SFTP://welcometotheroad.net"
    [root@acme logs]# THFolderName="OUTBOUND"
    [root@acme logs]# THFolder='/'"$THFolderName"
    [root@acme logs]# THSftpAddress=$targetHost$THFolder
    [root@acme logs]# THDeleteSftpAddress=$targetHost$THFolder'/'


    Here I set up authentication on the remote system:



    [root@acme logs]# username=mrRoadRunner
    [root@acme logs]# password=Beep-8eep!
    [root@acme logs]# sessionAuthentication="$username":"$password"


    Here I set the file reference:



    [root@acme logs]# fileref="openroad2019.xml"


    Here I verify that the file exists on the remote server:



    [root@acme logs]# THFiles=$(curl -sSk -u $sessionAuthentication $THSftpAddress | grep $fileref | awk '{print $9}')
    [root@acme logs]# echo $THFiles
    [root@acme logs]# openroad2019.xml


    Here I begin my loop:



    [root@acme logs]# for targetFile in $THFiles
    > do
    > dateTimeStamp=`date +%Y%m%d%H%M%S`
    > traceLog="$logFolder"/"$targetFile"trace"$dateTimeStamp".log
    > testLog="$logFolder"/test"$dateTimeStamp".log
    > deltraceLog="$logFolder"/del"$targetFile"trace"$dateTimeStamp".log
    > deltestLog="$logFolder"/deltest"$dateTimeStamp".log
    > deleteString='"-rm '"$THFolderName"'/'"$targetFile"'"'
    > masterGetStr=`echo curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>>"$testLog" 2>&1`
    > masterDeleteStr=`echo curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1`
    > echo
    > echo -----
    > echo "$masterGetStr"
    > echo --
    > echo "$masterDeleteStr"
    > echo -----
    > echo
    > curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>> "$testLog" 2>&1
    > curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1
    > done


    Here is the output:



    -----
    curl -k --trace /ftp/roadrunner/inbound/logs/openroad2019.xmltrace20190628180349.log --user mrRoadRunner:Beep-8eep! -O SFTP://welcometotheroad.net/OUTBOUND/openroad2019.xml --ftp-ssl &>>/ftp/roadrunner/inbound/logs/test20190628180349.log 2>&1
    --
    curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1
    -----


    The first curl command works just fine, drops the file right where I need it.



    The second curl command is supposed to delete the file on the remote system and it is not working. Here I view the logs on that:



    ::::::::::::::
    delopenroad2019.xmltrace20190628180349.log
    ::::::::::::::
    == Info: Trying 0.0.0.0...
    == Info: TCP_NODELAY set
    == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
    == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
    == Info: SSH authentication methods available: publickey,password
    == Info: Using SSH private key file '/root/.ssh/id_rsa'
    == Info: SSH public key authentication failed: Username/PublicKey combination invalid
    == Info: Initialized password authentication
    == Info: Authentication complete
    == Info: Sending quote commands
    == Info: Syntax error in SFTP command. Supply parameter(s)!
    == Info: Connection #0 to host welcometotheroad.net left intact
    == Info: getaddrinfo(3) failed for OUTBOUND:80
    == Info: Couldn't resolve host 'OUTBOUND'
    == Info: Closing connection 1
    ::::::::::::::
    deltest20190628180349.log
    ::::::::::::::
    curl: (21) Syntax error in SFTP command. Supply parameter(s)!
    curl: (6) Couldn't resolve host 'OUTBOUND'
    ::::::::::::::
    test20190628180349.log
    ::::::::::::::
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 4290 100 4290 0 0 3248 0 0:00:01 0:00:01 --:--:-- 3252
    100 4290 100 4290 0 0 3247 0 0:00:01 0:00:01 --:--:-- 3247
    [root@acme logs]#


    Yet, when I type in the command manually - it works and deletes the file off the remote system.



    curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1

    [root@rh1 logs]# more *20190628180546*.log

    ::::::::::::::
    openroad2019.xmltrace20190628180546.log
    ::::::::::::::
    Info: Trying 0.0.0.0...
    == Info: TCP_NODELAY set
    == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
    == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
    == Info: SSH authentication methods available: publickey,password
    == Info: Using SSH private key file '/root/.ssh/id_rsa'
    == Info: SSH public key authentication failed: Username/PublicKey combination invalid
    == Info: Initialized password authentication
    == Info: Authentication complete
    <= Recv data, 2000 bytes (0x7d0)
    0000: ef bb bf 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e ...<?xml version
    ...
    ... (details removed)
    ...
    0110: 6e 73 74 72 75 63 74 69 6f 6e 73 48 65 61 64 65 nstructionsHeade
    0120: 72 3e r>
    == Info: Connection #0 to host welcometotheroad.net left intact

    ::::::::::::::
    del_openroad2019.xmltrace20190628180546.log
    ::::::::::::::
    == Info: Trying 0.0.0.0...
    == Info: TCP_NODELAY set
    == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
    == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
    == Info: SSH authentication methods available: publickey,password
    == Info: Using SSH private key file '/root/.ssh/id_rsa'
    == Info: SSH public key authentication failed: Username/PublicKey combination invalid
    == Info: Initialized password authentication
    == Info: Authentication complete
    => Send data, 55 bytes (0x37)
    0000: 64 72 77 78 72 2d 78 2d 2d 2d 20 32 20 66 74 70 drwxr-x--- 2 ftp
    0010: 61 64 6d 69 6e 20 66 74 70 61 64 6d 69 6e 20 20 admin ftpadmin
    ...
    ... (details removed)
    ...
    0050: 30 30 2d 32 36 37 36 39 36 37 33 5f 44 49 5f 4c 00-26769673_DI_L
    0060: 45 30 2e 58 4d 4c 0a E0.XML.
    == Info: Sending quote commands
    == Info: Connection #0 to host welcometotheroad.net left intact

    ::::::::::::::
    delopenroad2019.xmltrace20190628180546.log
    ::::::::::::::
    == Info: Trying 0.0.0.0...
    == Info: TCP_NODELAY set
    == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
    == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
    == Info: SSH authentication methods available: publickey,password
    == Info: Using SSH private key file '/root/.ssh/id_rsa'
    == Info: SSH public key authentication failed: Username/PublicKey combination invalid
    == Info: Initialized password authentication
    == Info: Authentication complete
    == Info: Sending quote commands
    == Info: Syntax error in SFTP command. Supply parameter(s)!
    == Info: Connection #0 to host welcometotheroad.net left intact
    == Info: getaddrinfo(3) failed for OUTBOUND:80
    == Info: Couldn't resolve host 'OUTBOUND'
    == Info: Closing connection 1

    ::::::::::::::
    del_test20190628180546.log
    ::::::::::::::
    drwxr-x--- 2 ftpadmin ftpadmin 0 Jun 28 23:38 .
    drwxr-x--- 2 ftpadmin ftpadmin 0 Apr 26 2019 ..
    -rwxr-x--- 1 ftpadmin ftpadmin 7780 Jun 27 14:36 NextFile20190620172738.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 2440 Jun 27 14:36 NextFile20190620172740.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 7980 Jun 27 14:36 NextFile20190624111531.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 2441 Jun 27 14:36 NextFile20190624111533.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 14:36 NextFile20190626165728.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 14:36 NextFile20190626165729.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 15424 Jun 27 14:36 NextFile20190627091426.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 4104 Jun 27 14:37 NextFile20190627091427.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 10417 Jun 27 14:37 NextFile20190627092525.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 3071 Jun 27 14:37 NextFile20190627092527.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 15594 Jun 27 14:37 NextFile20190627093345.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 4279 Jun 27 14:37 NextFile20190627093347.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 17237 Jun 27 14:37 NextFile20190627094528.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 4290 Jun 27 14:37 NextFile20190627094530.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 15608 Jun 27 14:37 NextFile20190627100222.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 4288 Jun 27 14:37 NextFile20190627100224.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 2455 Jun 27 14:37 NextFile20190627102026.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 15:18 NextFile20190627111647.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 15:18 NextFile20190627111648.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 18:56 NextFile20190627145327.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 18:56 NextFile20190627145328.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 12797 Jun 27 20:08 NextFile20190627160344.XML
    -rwxr-x--- 1 ftpadmin ftpadmin 3609 Jun 27 20:08 NextFile20190627160345.XML


    My question is "WHY WONT IT WORK IN THE FOR LOOP?"










    share|improve this question



























      0












      0








      0








      Is there any reason why a curl command wont work with variables?



      Here is my set up - I am not using real values as I can not expose client data and I have no test environment



      You will notice that I am using two curl commands, yes I know it can be combined into one command, but I haven't been able to make that work so I am splitting then up unto two separate commands to test with.



      Here I set up the paths for inbound folder on my system:



      [root@acme logs]# act="roadrunner"
      [root@acme logs]# content="xml"
      [root@acme logs]# inbndfldr='/ftp/'"$act"'/inbound'
      [root@acme logs]# destinationFolder="$inbndfldr"/"$content"/
      [root@acme logs]# logFolder="$inbndfldr"/logs


      Here I set up the paths for outbound folder on the remote system:



      [root@acme logs]# targetHost="SFTP://welcometotheroad.net"
      [root@acme logs]# THFolderName="OUTBOUND"
      [root@acme logs]# THFolder='/'"$THFolderName"
      [root@acme logs]# THSftpAddress=$targetHost$THFolder
      [root@acme logs]# THDeleteSftpAddress=$targetHost$THFolder'/'


      Here I set up authentication on the remote system:



      [root@acme logs]# username=mrRoadRunner
      [root@acme logs]# password=Beep-8eep!
      [root@acme logs]# sessionAuthentication="$username":"$password"


      Here I set the file reference:



      [root@acme logs]# fileref="openroad2019.xml"


      Here I verify that the file exists on the remote server:



      [root@acme logs]# THFiles=$(curl -sSk -u $sessionAuthentication $THSftpAddress | grep $fileref | awk '{print $9}')
      [root@acme logs]# echo $THFiles
      [root@acme logs]# openroad2019.xml


      Here I begin my loop:



      [root@acme logs]# for targetFile in $THFiles
      > do
      > dateTimeStamp=`date +%Y%m%d%H%M%S`
      > traceLog="$logFolder"/"$targetFile"trace"$dateTimeStamp".log
      > testLog="$logFolder"/test"$dateTimeStamp".log
      > deltraceLog="$logFolder"/del"$targetFile"trace"$dateTimeStamp".log
      > deltestLog="$logFolder"/deltest"$dateTimeStamp".log
      > deleteString='"-rm '"$THFolderName"'/'"$targetFile"'"'
      > masterGetStr=`echo curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>>"$testLog" 2>&1`
      > masterDeleteStr=`echo curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1`
      > echo
      > echo -----
      > echo "$masterGetStr"
      > echo --
      > echo "$masterDeleteStr"
      > echo -----
      > echo
      > curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>> "$testLog" 2>&1
      > curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1
      > done


      Here is the output:



      -----
      curl -k --trace /ftp/roadrunner/inbound/logs/openroad2019.xmltrace20190628180349.log --user mrRoadRunner:Beep-8eep! -O SFTP://welcometotheroad.net/OUTBOUND/openroad2019.xml --ftp-ssl &>>/ftp/roadrunner/inbound/logs/test20190628180349.log 2>&1
      --
      curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1
      -----


      The first curl command works just fine, drops the file right where I need it.



      The second curl command is supposed to delete the file on the remote system and it is not working. Here I view the logs on that:



      ::::::::::::::
      delopenroad2019.xmltrace20190628180349.log
      ::::::::::::::
      == Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      == Info: Sending quote commands
      == Info: Syntax error in SFTP command. Supply parameter(s)!
      == Info: Connection #0 to host welcometotheroad.net left intact
      == Info: getaddrinfo(3) failed for OUTBOUND:80
      == Info: Couldn't resolve host 'OUTBOUND'
      == Info: Closing connection 1
      ::::::::::::::
      deltest20190628180349.log
      ::::::::::::::
      curl: (21) Syntax error in SFTP command. Supply parameter(s)!
      curl: (6) Couldn't resolve host 'OUTBOUND'
      ::::::::::::::
      test20190628180349.log
      ::::::::::::::
      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      100 4290 100 4290 0 0 3248 0 0:00:01 0:00:01 --:--:-- 3252
      100 4290 100 4290 0 0 3247 0 0:00:01 0:00:01 --:--:-- 3247
      [root@acme logs]#


      Yet, when I type in the command manually - it works and deletes the file off the remote system.



      curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1

      [root@rh1 logs]# more *20190628180546*.log

      ::::::::::::::
      openroad2019.xmltrace20190628180546.log
      ::::::::::::::
      Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      <= Recv data, 2000 bytes (0x7d0)
      0000: ef bb bf 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e ...<?xml version
      ...
      ... (details removed)
      ...
      0110: 6e 73 74 72 75 63 74 69 6f 6e 73 48 65 61 64 65 nstructionsHeade
      0120: 72 3e r>
      == Info: Connection #0 to host welcometotheroad.net left intact

      ::::::::::::::
      del_openroad2019.xmltrace20190628180546.log
      ::::::::::::::
      == Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      => Send data, 55 bytes (0x37)
      0000: 64 72 77 78 72 2d 78 2d 2d 2d 20 32 20 66 74 70 drwxr-x--- 2 ftp
      0010: 61 64 6d 69 6e 20 66 74 70 61 64 6d 69 6e 20 20 admin ftpadmin
      ...
      ... (details removed)
      ...
      0050: 30 30 2d 32 36 37 36 39 36 37 33 5f 44 49 5f 4c 00-26769673_DI_L
      0060: 45 30 2e 58 4d 4c 0a E0.XML.
      == Info: Sending quote commands
      == Info: Connection #0 to host welcometotheroad.net left intact

      ::::::::::::::
      delopenroad2019.xmltrace20190628180546.log
      ::::::::::::::
      == Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      == Info: Sending quote commands
      == Info: Syntax error in SFTP command. Supply parameter(s)!
      == Info: Connection #0 to host welcometotheroad.net left intact
      == Info: getaddrinfo(3) failed for OUTBOUND:80
      == Info: Couldn't resolve host 'OUTBOUND'
      == Info: Closing connection 1

      ::::::::::::::
      del_test20190628180546.log
      ::::::::::::::
      drwxr-x--- 2 ftpadmin ftpadmin 0 Jun 28 23:38 .
      drwxr-x--- 2 ftpadmin ftpadmin 0 Apr 26 2019 ..
      -rwxr-x--- 1 ftpadmin ftpadmin 7780 Jun 27 14:36 NextFile20190620172738.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2440 Jun 27 14:36 NextFile20190620172740.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7980 Jun 27 14:36 NextFile20190624111531.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2441 Jun 27 14:36 NextFile20190624111533.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 14:36 NextFile20190626165728.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 14:36 NextFile20190626165729.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 15424 Jun 27 14:36 NextFile20190627091426.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4104 Jun 27 14:37 NextFile20190627091427.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 10417 Jun 27 14:37 NextFile20190627092525.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 3071 Jun 27 14:37 NextFile20190627092527.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 15594 Jun 27 14:37 NextFile20190627093345.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4279 Jun 27 14:37 NextFile20190627093347.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 17237 Jun 27 14:37 NextFile20190627094528.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4290 Jun 27 14:37 NextFile20190627094530.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 15608 Jun 27 14:37 NextFile20190627100222.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4288 Jun 27 14:37 NextFile20190627100224.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2455 Jun 27 14:37 NextFile20190627102026.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 15:18 NextFile20190627111647.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 15:18 NextFile20190627111648.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 18:56 NextFile20190627145327.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 18:56 NextFile20190627145328.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 12797 Jun 27 20:08 NextFile20190627160344.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 3609 Jun 27 20:08 NextFile20190627160345.XML


      My question is "WHY WONT IT WORK IN THE FOR LOOP?"










      share|improve this question
















      Is there any reason why a curl command wont work with variables?



      Here is my set up - I am not using real values as I can not expose client data and I have no test environment



      You will notice that I am using two curl commands, yes I know it can be combined into one command, but I haven't been able to make that work so I am splitting then up unto two separate commands to test with.



      Here I set up the paths for inbound folder on my system:



      [root@acme logs]# act="roadrunner"
      [root@acme logs]# content="xml"
      [root@acme logs]# inbndfldr='/ftp/'"$act"'/inbound'
      [root@acme logs]# destinationFolder="$inbndfldr"/"$content"/
      [root@acme logs]# logFolder="$inbndfldr"/logs


      Here I set up the paths for outbound folder on the remote system:



      [root@acme logs]# targetHost="SFTP://welcometotheroad.net"
      [root@acme logs]# THFolderName="OUTBOUND"
      [root@acme logs]# THFolder='/'"$THFolderName"
      [root@acme logs]# THSftpAddress=$targetHost$THFolder
      [root@acme logs]# THDeleteSftpAddress=$targetHost$THFolder'/'


      Here I set up authentication on the remote system:



      [root@acme logs]# username=mrRoadRunner
      [root@acme logs]# password=Beep-8eep!
      [root@acme logs]# sessionAuthentication="$username":"$password"


      Here I set the file reference:



      [root@acme logs]# fileref="openroad2019.xml"


      Here I verify that the file exists on the remote server:



      [root@acme logs]# THFiles=$(curl -sSk -u $sessionAuthentication $THSftpAddress | grep $fileref | awk '{print $9}')
      [root@acme logs]# echo $THFiles
      [root@acme logs]# openroad2019.xml


      Here I begin my loop:



      [root@acme logs]# for targetFile in $THFiles
      > do
      > dateTimeStamp=`date +%Y%m%d%H%M%S`
      > traceLog="$logFolder"/"$targetFile"trace"$dateTimeStamp".log
      > testLog="$logFolder"/test"$dateTimeStamp".log
      > deltraceLog="$logFolder"/del"$targetFile"trace"$dateTimeStamp".log
      > deltestLog="$logFolder"/deltest"$dateTimeStamp".log
      > deleteString='"-rm '"$THFolderName"'/'"$targetFile"'"'
      > masterGetStr=`echo curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>>"$testLog" 2>&1`
      > masterDeleteStr=`echo curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1`
      > echo
      > echo -----
      > echo "$masterGetStr"
      > echo --
      > echo "$masterDeleteStr"
      > echo -----
      > echo
      > curl -k --trace "$traceLog" --user "$sessionAuthentication" -O "$THSftpAddress"/"$targetFile" --ftp-ssl &>> "$testLog" 2>&1
      > curl -sSk --trace $deltraceLog -u $sessionAuthentication $THDeleteSftpAddress -Q$deleteString &>> $deltestLog 2>&1
      > done


      Here is the output:



      -----
      curl -k --trace /ftp/roadrunner/inbound/logs/openroad2019.xmltrace20190628180349.log --user mrRoadRunner:Beep-8eep! -O SFTP://welcometotheroad.net/OUTBOUND/openroad2019.xml --ftp-ssl &>>/ftp/roadrunner/inbound/logs/test20190628180349.log 2>&1
      --
      curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1
      -----


      The first curl command works just fine, drops the file right where I need it.



      The second curl command is supposed to delete the file on the remote system and it is not working. Here I view the logs on that:



      ::::::::::::::
      delopenroad2019.xmltrace20190628180349.log
      ::::::::::::::
      == Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      == Info: Sending quote commands
      == Info: Syntax error in SFTP command. Supply parameter(s)!
      == Info: Connection #0 to host welcometotheroad.net left intact
      == Info: getaddrinfo(3) failed for OUTBOUND:80
      == Info: Couldn't resolve host 'OUTBOUND'
      == Info: Closing connection 1
      ::::::::::::::
      deltest20190628180349.log
      ::::::::::::::
      curl: (21) Syntax error in SFTP command. Supply parameter(s)!
      curl: (6) Couldn't resolve host 'OUTBOUND'
      ::::::::::::::
      test20190628180349.log
      ::::::::::::::
      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      100 4290 100 4290 0 0 3248 0 0:00:01 0:00:01 --:--:-- 3252
      100 4290 100 4290 0 0 3247 0 0:00:01 0:00:01 --:--:-- 3247
      [root@acme logs]#


      Yet, when I type in the command manually - it works and deletes the file off the remote system.



      curl -sSk --trace /ftp/roadrunner/inbound/logs/delopenroad2019.xmltrace20190628180349.log -u mrRoadRunner:Beep-8eep! SFTP://welcometotheroad.net/OUTBOUND/ -Q"-rm OUTBOUND/openroad2019.xml" &>> /ftp/roadrunner/inbound/logs/deltest20190628180349.log 2>&1

      [root@rh1 logs]# more *20190628180546*.log

      ::::::::::::::
      openroad2019.xmltrace20190628180546.log
      ::::::::::::::
      Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      <= Recv data, 2000 bytes (0x7d0)
      0000: ef bb bf 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e ...<?xml version
      ...
      ... (details removed)
      ...
      0110: 6e 73 74 72 75 63 74 69 6f 6e 73 48 65 61 64 65 nstructionsHeade
      0120: 72 3e r>
      == Info: Connection #0 to host welcometotheroad.net left intact

      ::::::::::::::
      del_openroad2019.xmltrace20190628180546.log
      ::::::::::::::
      == Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      => Send data, 55 bytes (0x37)
      0000: 64 72 77 78 72 2d 78 2d 2d 2d 20 32 20 66 74 70 drwxr-x--- 2 ftp
      0010: 61 64 6d 69 6e 20 66 74 70 61 64 6d 69 6e 20 20 admin ftpadmin
      ...
      ... (details removed)
      ...
      0050: 30 30 2d 32 36 37 36 39 36 37 33 5f 44 49 5f 4c 00-26769673_DI_L
      0060: 45 30 2e 58 4d 4c 0a E0.XML.
      == Info: Sending quote commands
      == Info: Connection #0 to host welcometotheroad.net left intact

      ::::::::::::::
      delopenroad2019.xmltrace20190628180546.log
      ::::::::::::::
      == Info: Trying 0.0.0.0...
      == Info: TCP_NODELAY set
      == Info: Connected to welcometotheroad.net (0.0.0.0) port 22 (#0)
      == Info: SSH MD5 fingerprint: Th3re1$4WarpDr1v3N$+4r$#1P!
      == Info: SSH authentication methods available: publickey,password
      == Info: Using SSH private key file '/root/.ssh/id_rsa'
      == Info: SSH public key authentication failed: Username/PublicKey combination invalid
      == Info: Initialized password authentication
      == Info: Authentication complete
      == Info: Sending quote commands
      == Info: Syntax error in SFTP command. Supply parameter(s)!
      == Info: Connection #0 to host welcometotheroad.net left intact
      == Info: getaddrinfo(3) failed for OUTBOUND:80
      == Info: Couldn't resolve host 'OUTBOUND'
      == Info: Closing connection 1

      ::::::::::::::
      del_test20190628180546.log
      ::::::::::::::
      drwxr-x--- 2 ftpadmin ftpadmin 0 Jun 28 23:38 .
      drwxr-x--- 2 ftpadmin ftpadmin 0 Apr 26 2019 ..
      -rwxr-x--- 1 ftpadmin ftpadmin 7780 Jun 27 14:36 NextFile20190620172738.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2440 Jun 27 14:36 NextFile20190620172740.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7980 Jun 27 14:36 NextFile20190624111531.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2441 Jun 27 14:36 NextFile20190624111533.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 14:36 NextFile20190626165728.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 14:36 NextFile20190626165729.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 15424 Jun 27 14:36 NextFile20190627091426.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4104 Jun 27 14:37 NextFile20190627091427.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 10417 Jun 27 14:37 NextFile20190627092525.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 3071 Jun 27 14:37 NextFile20190627092527.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 15594 Jun 27 14:37 NextFile20190627093345.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4279 Jun 27 14:37 NextFile20190627093347.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 17237 Jun 27 14:37 NextFile20190627094528.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4290 Jun 27 14:37 NextFile20190627094530.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 15608 Jun 27 14:37 NextFile20190627100222.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 4288 Jun 27 14:37 NextFile20190627100224.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2455 Jun 27 14:37 NextFile20190627102026.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 15:18 NextFile20190627111647.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 15:18 NextFile20190627111648.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 7858 Jun 27 18:56 NextFile20190627145327.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 2500 Jun 27 18:56 NextFile20190627145328.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 12797 Jun 27 20:08 NextFile20190627160344.XML
      -rwxr-x--- 1 ftpadmin ftpadmin 3609 Jun 27 20:08 NextFile20190627160345.XML


      My question is "WHY WONT IT WORK IN THE FOR LOOP?"







      linux rhel curl sftp delete






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 38 mins ago







      ajtorre27

















      asked 44 mins ago









      ajtorre27ajtorre27

      61 bronze badge




      61 bronze badge






















          0






          active

          oldest

          votes














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f527594%2fcurl-delete-command-woint-work-in-scripted-for-loop%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f527594%2fcurl-delete-command-woint-work-in-scripted-for-loop%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...