Programming :: Where Does Unistd Redirect To
Apr 20, 2010Does unistd.h declare functions in the kernel or in the stdclib? Or in any other C file. I need to know from the inside how some of the functions work.
So where does unistd redirect to?
Does unistd.h declare functions in the kernel or in the stdclib? Or in any other C file. I need to know from the inside how some of the functions work.
So where does unistd redirect to?
I am trying to grep multiple numbers from file, grep does have the -f option for that.
Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with
Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?
My hardware is the FriendlyArm mini2440 Samsung board. I run our main application from init.d/rcS. It uses printf's to display continuous program debug information that can be seen on the serial ttySAC2 console. I would like to be able to remotely view this information by a telnet connection when needed. What is the best way to accomplish this? The telnet user can possibly activate some script or program. I saw there is a ttysnoop program that I could not get to compile.
There must be a simpler way. There must be several ways. Instead of using printf I could do something else. I do not want to use a normal log file to the flash file system. I had thought of using a ram file in /var directory but it would complicate matters as I would need to limit its size and the telnet user needs to view the program's printfs in a real time fashion.
I am again struggling to make a script work, but hey, it is fun, I am learning new things. I discovered the set -x option which was, for me, like the second coming. Still, what I am not able to do is redirect ALL output to a (log) file, including what is produced by the -x setting. Let's assume a very simple script:
Code: #!/bin/bash
set -x
source="/home/atelier/Bureau/"
ls -la $source and I am running it as . test.sh >> /var/log/test.rmcb.log
The result of ls goes inded into the log file, but the rest still shows on the console where I am running the script: Code: ++ source=/home/atelier/Bureau/
++ ls --color=auto -la /home/atelier/Bureau/ Is there a way to redirect EVERYTHING to the log file ?
I feel kind of embarrassed posting here, but this is technically a scripting sub-forum. Here is the problem. I have a folder with various files which include .txt files as well
How can i redirect same content to each of the .txt files in the folder?
I have tried
Code: $ echo "hello" > *.txt
-bash: !": event not found Code: also cat ~/otherdir/test.txt > *.txt
-bash: *.txt: ambiguous redirect Can anyone help me with this?Ok i solved it
Code: #! /bin/bash
for file in *.txt
do
echo "Text that needs to be written" > $file
done
I have this code in PHP that is hosted on an nginx server.
Code:
I can download the files but the problem is I think nginx is treating it as a text file and changes all "0x0A" to "0x0D 0x0A"
Unfortunately the files are not text files but executable files which makes the downloaded file corrupted.
Do I need to add a specific header to prevent this from happening?
I want to do the following redirectin inside a bash script :
1. all the stdout will be redirected to a /tmp/log
2. all the errors will go to the stderr and also to the /tmp/log.
The following inside a bash script is not working, WHY and HOW to do it:
Rest of the bash script.
I have a little complex Makefile system. A parent Makefile call dozens of Makefiles in subdirctories. And the subdirctory Makefile calles shell script to do real building. I want to grab all output this Makefile system generate. So, i employ "make 2>&1 > make.log". but not all output messages are filed into make.log. The message generated by sub-makefile called shell script cannot be recorded into make.log. And another curiouse thing is, if i launch "make 2>&1 > make.log" in a perl script, all output do be sent into make.log.
View 2 Replies View RelatedI would really like to capture the output of scp and my file's progress. Scp updates the transfer rate every 1 second, and I will like to save the transfer rate at every update. So for example, if the file transfer takes 30 seconds, I would like 30 reports of the transfer rate.
The output looks like:
Code:
file.dat 1% 3664KB 938.5KB/s 05:48
Whenever I try a simple redirect like:
Code:
scp file.dat 192.168.1.100:~/ &> output
... it does not save the rate at every update, it only shows the final rate.
If I try using typescript by starting "script" ... it's the same deal.
I need to redirect a /usr/sbin/sendmail command to $HOME/bin/msmtp .The sendmail command would be coming from a PHP5 application. I'm assuming the best way is to use .bashrc, but .htaccess is also available.The remote server is a shared web host which is running Debian 4.0.I do not have root access.I have SSH access.
View 2 Replies View RelatedI'm trying to write a shell script that do ftp and download file periodically, this script should be called by a daemon running in the background.
the shell script "script.sh" is as follows:
Code:
yafc ftp://test:test@192.168.1.225:21 < commands
and the "commands" files is
Code:
d Root/md5* /
quit
if I run script.sh it will work just fine. But when the daemon software calls the "script.sh", the script will send ftp login request to the ftp server, but will not even answer the username or anything.
I believe it is something about child process redirection, but I don't know how to deal with it.
This problem is not only with yafc, it is the same with any ftp client or any application like telnet and so.
I have a huge database of students, I would like extract these data and write to individual file for each students.
I am running a loop in shell program (.sh file), the output of each run in the loop need to redirected to a file with variable name.
I tried the following line, but it did not work, where BodyMsg is the data and Rollno is the students roll number.
echo $BodyMsg > $RolNo".html"
I need to output of the script to the remote server via redirect. I created a simple script for your reference.Quote:
#!/bin/bash
W=`/usr/bin/w`
FREE=`/usr/bin/free`
[code]...
I have got a script with an outer and inner loop. The inner loop issues loads of echo's which need to be redirected to a log file determined by the outer loop. The obvious solution is to redirect every echo to >$LOG and set LOG in the outer loop.
Code:
for f in $FILES ; do
LOG=<logfile>
for l in $LINES ; do
[code]....
it is possible to map stdout to $LOG in the outer loop without having to redirect every subsequent individual command output?
I did a select on my db and now I need that this if consult return true for me salve the columns information in file. How I do this in Shell?!
View 3 Replies View RelatedI have a collection of redirect links I need to grab the final domain from (indicated after "->"):
[url]
[url]
I'm thinking PHP/cURL is the way to do it. I've searched the net but failed to find a solution that works for all redirection links.
I am using a simple javascript to connect my flv streams with Red5 (streaming server) every thing is working perfectly fine in Mozilla and Chrome.
But when it comes to IE it simply wont load the player.
Here is my script code...
How do I detect the client browser and redirect him to adobe flash upgrade page if the client browser does not have a supported player?
To redirect standard output to multiple files:
Code:
echo Test | tee file1 file2
My problem is that the word "Test" still displays to the screen? I want same effect as:
Code:
echo Test > file1
but with multiple file redirection.
How system call internals could be known ? I mean for example if i take the example of write system call of linux kernel, where i can find out the code of write() system call in the kernel source tree ? The problem is write() system call directly write on console.If we want to write the data on some web page then write() system call will not do that ? How to redirect out data from console to application like html/web page?
View 6 Replies View RelatedI have recently merged two Joomla 1.0 sites I ran into one. I imported the articles I wanted to keep to the new site, and I have the old site's domain pointing as an alias at the new site. The new site is www.theouthousers.com . The old site was www.bludblood.com .
I also have the core SEF URLs on, using the htaccess.txt file that came with Joomla.
I have one writer for the old site who linked to his articles in various places, so I am trying to set up redirects for him so that he doesn't have to change all of his links.
For instance, I need something like:
http://www.bludblood.com/joomla/inde...d=25&Itemid=51
To redirect to the equivalent location on the new site:
[url]
And I also need specific links like:
[url]
To redirect to their new counterparts:
[url]
Keeping in mind that www.bludblood.com is now an alias of www.theouthousers.com, is there any way to do this? I have been trying with rewrite rules and redirects, and cannot seem to achieve the desired effect.
Tried various versions of:
Code:
Redirect [url] [url]
With the http, without, as regexps, as 301s, as permanents, etc, and it just will not work. Also tried as RewriteRule.
My friend has a website whereby once you have logged in on one page, you are redirected to another page, with a url similar to:
[URL]
the random string changes each time you log in, however the login page has a static url What i was attempting to do is run a script to get some data from the members page (after uve logged in) - however ive been having some trouble in how to do this, as the variable url with the random string will become invalid after a certain time, and i did not want to consantly change it.
While reading through some documentation i read that wget should be able to login to a form login website however ive had no luck, the command i was attempting to use was:
wget --user USERNAME -password PASSWORD [URL]
similarly i also tried
wget --post-data "username=USERNAME&password=PASSWORD" [URL]
and even both combined. However neither has worked as the html dl'd is simply the login page website. I cannot post a direct link to the website as it is private, however ive looked at the source coding and ive extracted (what i think) is the relevant bit, which is:
Code:
<form action="/cgi-bin/sblogin/login.cgi" method="post" name="login" id="login"><br /><br />
<div class="user_text"><span class="text3">USERNAME:</span></div><div class="user_box"><input type="text" class="text" name="uname"></div>
[code].....
Got site hosted, up and running now trying to work out the website particulars.
Right here it goes, not sure if it is at all possible but any input would be much appreciated.
Here's the deal. Developing an easy straight forward online store integrated with EBSWorldpay . Not looking for any fancy stuff. What i would like to do is put a flash url link that would direct a user to a html file that contains a hidden form and it would submit it on load redirecting a user straight to EBSwordpay checkout. Simple HTML Redirect with submited form.
Check the link here it has the source code of the form that is required.: [url]
Trying to use Example 0.1 ( So instead of having a separate page with a "BUY" for the form to be submitted, I would like to get the form posted straight away which would in turn load the payment site. Would create a seperate html file for each item and have redirects on the main website linking to those onLoad submit forms.
I have a set of bash scripts that I'm running that automatically build a set of packages for me and redirect their output into logs. Basically, I have a bunch of lines that are something like this: ${CONFIGURE_DIR}/configure &> ${LOG_DIR}/log or cd ${CONFIGURE_DIR} && make &> ${LOG_DIR}/log, etc.
This is supposed to make the entire process silent. However, sometimes with some packages some output leaks to my console (either stdout or stderr). I'm thinking that maybe the configure scripts/make are executing commands within new shell instances that don't inherit my redirect, or something to that effect.
Another reason for thinking this is that in another part of my script I detect errors when running make by testing with "if [ $? -ne 0 ]", and if the redirect leaks to my console and also the leaked output indicates that the build failed ("make: Error" and so on), then my $? test fails (i.e., it thinks that $? == 0, whereas a failed make should return a non-zero value). It's as if my original script can't "see" the results from child commands executed from later scripts.
error: syntax error before "pid_t" - in unistd.h ?
View 3 Replies View RelatedI use Centos 5.4, squid 2.6 stable21
I want to redirect only one url to another in a simpliest way.
http://test1.ch is the main page [url]is the sub page(alias) in another language(italian)
So that means every request on [url] should be redirected to [url]
I already tried: redirect permanent [url] but nothing happens
I seem to have lost vlc. It was working ok til I tried the following from [url].
"Like I told you before, files aren't the only places where you can redirect the standard output. You can redirect it to devices, too: $ cat sound.wav > /dev/audio
As you saw, in the above example the cat command concatenates a file named sound.wav and the results are sent to a device called /dev/audio. What's the fun here, then? /dev/audio is the audio device, and when you send there the contents of a sound file, that file is played. So if your sound is properly configured, the above command plays the file sound.wav!"
I thought that if I sent a music file to vlc in this way, vlc would play it. So I did cat song.mp3 > /usr/bin/vlc. At this point vlc stopped working. I looked in /usr/bin and found that vlc had been turned into a music file! So I erased it, and removed it via yum. Success. Then I reinstalled via yum; success. But the messages now are: from terminal:
[From gui: Could not launch 'VLC media player' Failed to execute child process "vlc" (No such file or directory).
I like to redirect some websites to [URL]... how to perform this? For example when i enter "[URL]... " it should redirect it to "[URL]..."
View 6 Replies View RelatedI know that set -x can be used for debugging a shell script.But I want to redirect the output of set -x to a text file.eg: Say test.sh is my script,
View 3 Replies View RelatedI'm using Apache 2 on a Linux server and I was wondering if it was possible to redirect certain IP ranges to another page. I know it's possible to block an IP, but is there a way to block all IP's and only allow a certain IP range to connect, such as 5.87.xxx.xxx? I own this server, so if I need to use another OS, webserver, change configuration files, etc., that's fine.
View 2 Replies View Related