General :: How To Using Redirection To Create A File
May 15, 2011
I have a linux script that generates a string and prints it to the console. I want this string to be the name of a file and open it for editing in vi. How can this be done?
View 3 Replies
ADVERTISEMENT
Sep 3, 2010
What's the difference between using > and >>? How can I use both < and > (redirection operators) in a single command?
View 2 Replies
View Related
Mar 3, 2010
i've checked the link, and it makes it better. but it doesn't include all the information. i'll continue searching the internet. However i have seen an example of creating a fd:
Code:
exec 5<&1
echo "TEST" >&5
exec 5>&-
as in the page, this was intended to redirect the stdout to the fd 5 and create it, and close it. i have the following questions:- what is exactly the meaning of second command? is it to redirect the command stdout "test" to the fd 5? and how i can see the contents of the fd 5? - in the first command, why the < is used instead if > and what is the difference between the below two commands as in the info bash *Redirection section It will be helpful if anyone could include a graph for file descriptor before and after different command execution.
[Code]...
View 5 Replies
View Related
Dec 7, 2010
I'm working on some scheduled task script files to keep nightly backups of some of our database information in place, and it's a bit annoying when they blow up. I know how to redirect stdout and stderr to a flat file I can view when I come in, and I know that 2>&1 maps them both to the same file (whatever was named in 1). However, I'm running into some cron-time situations where it's easier to have the two streams together, and other cron-time situations where it's easier to have them separated. I can't really tell which is going to happen; is there some way I could create both kinds of output file for my scripts, so that I've got a std_err only file and an interleaved std_out/std_err file?
Note: I've looked at the 'tee' command, but I don't think it will work for what I'm after. 'tee' appears to only work with stdout; I'm trying to work with stderr.
View 5 Replies
View Related
Apr 18, 2011
I am always confused about the redirection operator <Lets say i have a file input.txt that contains one word "hello" without the quotes when i do the following why don't i see any output? $echo < input.txt Secondly, i am slightly confused between input redirection < and pipe | operator. Sometimes they seem to do the same thing. For example i can achieve the output from the above command as follows $ cat input.txt | xargs echo
View 2 Replies
View Related
Apr 21, 2011
When I execute the following command from the linux command line I get the output I want to the screen
[Code]...
View 1 Replies
View Related
Sep 7, 2010
I'm writing a script to execute bash commands in the PHP CLI. I would like to suppress errors from bash and write my own error message if an error occurs. So far I have this (assuming log.txt doesn't exist!):
Code:
tac log.txt 2>/dev/null
Which works as expected, tac kicks up an error but the error is suppressed, but when I use this:
Code:
tac < log.txt 2>/dev/null
I get:
Code:
bash: log.txt: No such file or directory
The tac error is suppressed but bash still gives me a dirty error.
View 2 Replies
View Related
Jun 13, 2011
I was just testing specifying limit on file size to a user and have added the following to /etc/security/limits.conf bob soft fsize 100 This basically should have said not to allow bob to create anyfile greater than 100Kb in size.
But the interesting thing is, if bob already has any file which is greater than 100Kb in size, it even doesn't allow to log him into the system both from console and SSH. Also nothing is logged in logs.. How do I configure it so that, bob can login to the system even though he has any file greater than 100Kb (but doesn't allow him to create file which are greater than 100Kb) ??
View 3 Replies
View Related
Jul 26, 2010
I am testing my ftp server configuration.Anonymous download works , however anonymous upload does not.I am getting the following error message from both Windows and Linux 5.4clients : 553 cannot create the file.And i am running Fedore 12.
View 3 Replies
View Related
Jul 10, 2010
This is an examination senario. We have mulitple users logging into a RHEL-4 server using putty. These people are part of a same group. They are giving UNIX shell script exam.They are helping each other copy the code by using redirection to /dev/pts/x. Is there any way I can stop this redirection?
View 1 Replies
View Related
Feb 10, 2010
Under what condition port redirection could go useful?
View 2 Replies
View Related
Sep 8, 2010
Everything in Linux is a file, right? And everything can be represented by a file? Is there some way I could create a block device file that represents (i.e., provides an interface to) this image file? If so, then I could use fdisk on the device file to split it into partitions, format the partitions, and then mount them as directories. I could create a file system within a file system, which would be fun.
View 2 Replies
View Related
May 16, 2011
We have several HP Thin-Clients of type t5545 in use. We redirect USB-Media to the terminalserver. Because the t5545 runs a debian customized by hp, we can treat it like a debian in some way.First, I'll explain how usb-redirection is configured: automatically mount it to /tmp/tmpfs/media /tmp/tmpfs/media is redirected as disk "Z" via rdesktop-parameter -r disk:sharename=path in case of removed usb-media udev will run a script to umount -l the device and delete the mountpointThe environment:
Thin-Clients run linux: root@mac-addr:/tmp/tmpfs/media# uname -a
Linux mac-addr 2.6.26-2-686 1 SMP Wed Nov 4 20:45:37 UTC 2009 i686 GNU/Linux
Terminalserver runs Windows Server 2008 R2
[code]....
View 2 Replies
View Related
Dec 16, 2010
Some context: I'm calling some functions from within a C program and want to measure how long they take to execute. I've done this successfully, calling printf to print the results to the screen. This is reasonably fast. Ideally I'd like these to be dumped to a file, but fprintf presumably has some overhead since it writes to disk? Unless the data is buffered by the kernel and flushed later? What kind of delay can I expect before fprintf returns?
If I redirect the stdout to a file when I instantiate the binary as a process, will calls to printf also experience any overhead from redirection to a file? My aim here is to capture all data in a file, with the minimal amount of coding and effort, but with minimal impact in terms of time overheads for printf calls.
View 10 Replies
View Related
Jul 25, 2011
I have users using Windows XP, Windows 7, Linux (Fedora) and Mac. They all are in a single private network and all access internet through a Linux (RHEL5) system in which Squid acts as gateway. The same is true with my branch offices too except that private network is different and gateway system uses Fedora 9 instead of RHEL5. All the branch offices are connected through point to point leased lines with the head office for file transfer.
My requirement is this: I have a web server located at head office. Presently I am able to access this server from my branch offices through internet. I would like to access this server from branch offices through leased lines. This too I am able to access if I do routing in users system. The file transfer is taking place through one to one system at two ends by creating static routing in those systems.
View 1 Replies
View Related
Jan 13, 2011
I have a program that writes to stdout. Is there a way that I can redirect the output to the linux diff command or do I have to write the output to a file and then compare that. For example I have a bunch of test input files for a program and the corresponding expected output in another set of files. And I'd like to do something like ./program < t1.input | diff t1.expected.
View 3 Replies
View Related
Mar 2, 2011
why I cant seem to create a dot file (a file that starts with a dot) in my /tmp folder even with root priviledges. I installed F-Prot for linux & when I try to do a scan it complains it "can't stat a file" it seems to want to create & quits. So I tried creating it my self but it wont create a file that starts with a dot it seems. I also tried "chmod go+rx /tmp/*"
This is the error
root@JASONS-BRAAIN:/opt/f-prot# /opt/f-prot/fpscan -l
F-PROT Antivirus version 6.3.3.5015 (built: 2009-12-23T13-43-55)
FRISK Software International (C) Copyright 1989-2009
Engine version: 4.5.1.85
Arguments: -l
[Code].....
View 3 Replies
View Related
Oct 4, 2010
How do I create a LiveCD from an ISO file?
View 2 Replies
View Related
Mar 26, 2010
I am working on JNI(Java Native Interface) on fedora 7 where i need to create a .so file of .c.(For example Hello.c to Hello.so). But i am not getting options to be used with the "cc" command. What option or the command.
View 6 Replies
View Related
May 19, 2011
i'm trying to use tar to create a zip file but everytime I try using the command it just dumps out to the screen... I know i'm missing something simple but darned if I can figure out what it is. The command i'm using:tar -cpvz archive.bz2 /directory_name/*
View 5 Replies
View Related
Jan 16, 2011
I am using NetBSD-5.1. 1. I wanted to know what happens internally when we create a file in linux. ?The header file STDIO.H present in "src/include/stdio.h" contains a "FILE" structure with various members like _p, _cookie, etc. 2. wanted to know how does internally memory gets allocated for them.
View 1 Replies
View Related
Jul 4, 2010
I have a CMS I have developed, which will run on several sites all hosted in sub directories on my dedicated server. I want to create symlinks for the main files of the CMS, including all config files, functions and admin sections. Then there will be a few files specific to each site.I read some tutorials on creating symlinks, although most are not very good in my opinion.
Do you have to create a symlink for every file I want to include? Or can I just create a symlink to a directory? For example:CMS is located at /www/cms/.Can I make www/domain1/ point to that directory, and if so, will all files include themselves correctly. I think I am a bit confused on how this works.
View 1 Replies
View Related
Apr 5, 2011
I keep creating practice perl scripts in a linux directory using vi <filename> and need to chmod 751 <filename> before I can run it as I wish to. I'm sure there is a simple way to default my permissions or config them at creation, but I'm not familiar with it ayuda me por favor.
View 2 Replies
View Related
Jun 23, 2010
1. I need guide on how to create a folder name from the text file with .txt format.
2. First, I call the function of reading the directory.
3. Then, I dont know how to do.
4. Finally, I close the directory
This is my source code in perl
## read text.txt file ##
open F, "from/$directory/text.txt";
read F, $buf, 9999;
close F;[/size]
This source code is used to print the folder with date format like "ddmm" d stands for day and m stands for month
if ($command =~ s/-O "(.*)"/-O "$websites/$month/$file"/)
Instead, I want to have the name from text.txt to be folder name
View 4 Replies
View Related
Mar 31, 2011
Create a config file for Apache and this what I need to put and modify to meets my settings
NameVirtualHost *:9091
<VirtualHost *:9091>
DocumentRoot /var/www/trac/my_project
ServerName my_server_name
[Code].....
Do I simply add this within the /etc/httpd/conf/httpd.conf
if not how would I go about doing this
View 3 Replies
View Related
Nov 23, 2010
I having been searching for a way to create an empty or blank iso file, so that I can mount it, and have a backup application think it's a blank CD. I am tired of wasting CD's by having the application write a recovery CD, just for me to turn around and export it to an iso image to be stored in a online archive, and then throw away the physical CD.
View 5 Replies
View Related
Oct 8, 2010
I've tried to create a crontab that renames a fil extension every minute. This is what I've tried:*/1 * * * * / rename /home/bodil/Avräkningsfiler/'s/.txt/dat/' *.txtBut it doesn't seem to work.I've also tried to create a .sh file in the catalog itself with the command executing directly in the catalog but even though running the command by typing it in, it doesn't run automatically by cron
View 10 Replies
View Related
Jun 30, 2011
I am trying to write a script to pick the directory name from a list of file. Here is a detailed picture.Have a file name LIST which contains the follwing for example/apps/oracle/product/test1/apps/oracle/product/test2/apps/oracle/product/test3I need a script that reads these line from LIST and creates foldersin /apps/oracle/product/test1/backup/date/test1 after reading the first line
/backup/date/test2 after readin the second line/backup/date/test3 and so on.
View 15 Replies
View Related
Oct 3, 2010
Given a matrix with 0,1 entries, how can I create a graphic in linux such that we have a black square or pixel if the entry is one and white otherwise?
For example, if the matrix is:
0001000
0011100
0111110
0000000
then I want a graphic that looks like:
[code]....
I will be working with many large matrices, e.g. 1000x1000, or 5000x1000 so I need to do this automatically.
View 6 Replies
View Related
Apr 13, 2010
I am a newbie at Linux. I have installed Redhat Enterprise Linux desktop 5.3 on my machine. I do not know how to create a JFFS file system on Linux
View 1 Replies
View Related