redirect variable to same program at next loop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting redirect variable to same program at next loop
# 1  
Old 06-16-2008
redirect variable to same program at next loop

Hi all,

I don't know how to redirect a variable in this case:

while true
do
./ready_data
...
done

ready_data should read a file looking for an ID, if this doesn't exist then add the last ID seen into the first line.

When ID exists there is no problem, but when ID doesn't exist, I need the ID variable (inside ready_data) for the next loop process. I have tried with global variables but it seems not working.

while true
do
ID=`./ready_data` with echo ID inside ready_data is not working
done


Any idea on how can I do it?

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Seeing input that you redirect to a program on the shell

Suppose I have a program that I've written that accepts input, ie this C++ program: #include <iostream> using namespace std; int main() { cout << "Enter something:" << endl; int x; cin >> x; cout << "You entered data" << endl; } Suppose that I have a text file,... (5 Replies)
Discussion started by: Chris J
5 Replies

2. Shell Programming and Scripting

Redirect output of command line to for loop

I would like to redirect output of command line in for loop as $line. Output should be processed as line but instead it throw whole output. Could somebody help me on how to redirect output of command line and process it line by line without sending output to any file. below is my code ... (1 Reply)
Discussion started by: tapia
1 Replies

3. Shell Programming and Scripting

redirect frintf to a variable

how to redirect printf to a variable (8 Replies)
Discussion started by: robo
8 Replies

4. Shell Programming and Scripting

loop logic inside of an inline redirect?

i need to log the feedback from the ftp server as i'm performing some deletes. the only way i know of to do this is with the inline redirect << EOF ... but from there to the closing EOF, it's like i'm at the ftp command prompt, so I don't know how to have ksh script logic in there I have an... (3 Replies)
Discussion started by: tlavoie
3 Replies

5. Shell Programming and Scripting

after grep i want to redirect it to some variable

for the below grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1 the result of the grep i want to redirect into some variable, i tried to do veri=grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1 but it is... (2 Replies)
Discussion started by: mail2sant
2 Replies

6. UNIX for Dummies Questions & Answers

Redirect to variable

how do you redirect stdout into a variable. whenever I try I get an ambiguous redirect error :( I am trying to validate some user input and failing miserably. cal $MONTH $YEAR | grep -c "$DAY" if the above is 1 then it is valid if 0 then not valid. I have been trying to redirect the output... (2 Replies)
Discussion started by: MrAd
2 Replies

7. Shell Programming and Scripting

redirect exception messages from program

Hi, I have a script which invoke a java program and I would like to know whether it is possible to log the exception thrown by the program to a log file in the script? Thanks! (1 Reply)
Discussion started by: mpang_
1 Replies

8. UNIX for Dummies Questions & Answers

Redirect Output In Variable

how make assign the output of the command (for example: grep "file" "string" ) in a variable ($name)? i thing how put the result of the command (grep , cut, find ecc) in a variable.. IT's Possible ?? (1 Reply)
Discussion started by: ZINGARO
1 Replies

9. Shell Programming and Scripting

please help: how to redirect input into a variable

I'm trying to write a simple script program (C shell). I have a problem redirecting input into a variable. Say I have a variable called J, and there is file called result which contains just some number, say 5. Which command should I use to assign J value 5 from the file result. I tried the... (2 Replies)
Discussion started by: artur80
2 Replies
Login or Register to Ask a Question
CURLOPT_REDIR_PROTOCOLS(3)				     curl_easy_setopt options					CURLOPT_REDIR_PROTOCOLS(3)

NAME
CURLOPT_REDIR_PROTOCOLS - set protocols allowed to redirect to SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS, long bitmask); DESCRIPTION
Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask limits what protocols libcurl may use in a transfer that it follows to in a redirect when CURLOPT_FOLLOWLOCATION(3) is enabled. This allows you to limit specific transfers to only be allowed to use a subset of protocols in redirections. Protocols denied by CURLOPT_PROTOCOLS(3) are not overridden by this option. By default libcurl will allow all protocols on redirect except several disabled for security reasons: Since 7.19.4 FILE and SCP are dis- abled, and since 7.40.0 SMB and SMBS are also disabled. CURLPROTO_ALL enables all protocols on redirect, including those disabled for secu- rity. These are the available protocol defines: CURLPROTO_DICT CURLPROTO_FILE CURLPROTO_FTP CURLPROTO_FTPS CURLPROTO_GOPHER CURLPROTO_HTTP CURLPROTO_HTTPS CURLPROTO_IMAP CURLPROTO_IMAPS CURLPROTO_LDAP CURLPROTO_LDAPS CURLPROTO_POP3 CURLPROTO_POP3S CURLPROTO_RTMP CURLPROTO_RTMPE CURLPROTO_RTMPS CURLPROTO_RTMPT CURLPROTO_RTMPTE CURLPROTO_RTMPTS CURLPROTO_RTSP CURLPROTO_SCP CURLPROTO_SFTP CURLPROTO_SMB CURLPROTO_SMBS CURLPROTO_SMTP CURLPROTO_SMTPS CURLPROTO_TELNET CURLPROTO_TFTP DEFAULT
All protocols except for FILE, SCP and since 7.40.0 SMB and SMBS. PROTOCOLS
All EXAMPLE
curl = curl_easy_init(); if(curl) { /* pass in the URL from an external source */ curl_easy_setopt(curl, CURLOPT_URL, argv[1]); /* only allow redirects to HTTP and HTTPS URLs */ curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); /* Perform the request */ curl_easy_perform(curl); } AVAILABILITY
Added in 7.19.4, before then it would follow all protocols. RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. SEE ALSO
CURLOPT_PROTOCOLS(3), libcurl 7.54.0 September 21, 2016 CURLOPT_REDIR_PROTOCOLS(3)