The program actually works for me despite its many errors, but creates the file with 000 permissions which means you can't read it once its done. You should also be using the dup2 call instead of just hoping the next file you open becomes FD 1. I'd make these revisions:
Hi,
Program A: uses pipe()
I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using:
* child
-> dup2(fd, STDOUT_FILENO);
-> execl("/path/PROGRAM B", "PROGRAM B", NULL);
* parent
-> char line;
-> read(fd, line, 100);
Question:... (2 Replies)
Hi everyone, first post here.
Anyone who isn't interested in the background, press pagedown :).
I sometimes need to make scripts for little things I need in the infrastructure at the company I work at. Currently I am trying to make a wrapper script for a proprietary image-deployment program.... (2 Replies)
Hi all
I've run into a snag in a program of mine where part of what I entered in at the start of run-time, instead of the current value within printf() is being printed out.
After failing with fflush() and setbuf(), I tried the following approach
void BufferFlusher()
{
int in=0;... (9 Replies)
Hi,
i know how to
a) redirect stdout and stderr to one file,
b) and write to two files concurrently with same output using tee command
Now, i want to do both the above together.
I have a script and it should write both stdout and stderr in one file and also write the same content to... (8 Replies)
Hi,
I am working on a project where I have to generate and execute nasm code on-the-fly. I generate the code in a file program.asm and then execute it.This output is to stdout which i redirect to an output file which i read back to compare results:
system("nasm -f elf program.asm >... (5 Replies)
All,
Ok...so I know I *should* be able to control a process's stdin and stdout from the parent by creating pipes and then dup'ing them in the child. And, this works with all "normal" programs that I've tried. Unfortunately, I want to intercept the stdin/out of the scp application and it seems... (9 Replies)
I want to differentiate the STDOUT and STDERR messages in my terminal .
If a script or command is printing a message in terminal I want to differentiate by colors,
Is it possible ?
Example:
$date
Wed Jul 27 12:36:50 IST 2011
$datee
bash: datee: command not found
$alias ls
alias... (2 Replies)
Well.. let's say i need to write a pretty simple script.
In my script i have 2 variables which can have value of 0 or 1.
$VERBOSE
$LOG
I need to implement these cases:
($VERBOSE = 0 && $LOG = 0) => ONLY ERROR output (STDERR to console && STDOUT to /dev/null)
($VERBOSE = 1... (5 Replies)
Discussion started by: Marmz
5 Replies
LEARN ABOUT OSX
git-hash-object
GIT-HASH-OBJECT(1) Git Manual GIT-HASH-OBJECT(1)NAME
git-hash-object - Compute object ID and optionally creates a blob from a file
SYNOPSIS
git hash-object [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin [--literally]] [--] <file>...
git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]
DESCRIPTION
Computes the object ID value for an object with specified type with the contents of the named file (which can be outside of the work tree),
and optionally writes the resulting object into the object database. Reports its object ID to its standard output. This is used by git
cvsimport to update the index without modifying files in the work tree. When <type> is not specified, it defaults to "blob".
OPTIONS -t <type>
Specify the type (default: "blob").
-w
Actually write the object into the object database.
--stdin
Read the object from standard input instead of from a file.
--stdin-paths
Read file names from the standard input, one per line, instead of from the command-line.
--path
Hash object as it were located at the given path. The location of file does not directly influence on the hash value, but path is used
to determine what Git filters should be applied to the object before it can be placed to the object database, and, as result of
applying filters, the actual blob put into the object database may differ from the given file. This option is mainly useful for hashing
temporary files located outside of the working directory or files read from stdin.
--no-filters
Hash the contents as is, ignoring any input filter that would have been chosen by the attributes mechanism, including the end-of-line
conversion. If the file is read from standard input then this is always implied, unless the --path option is given.
--literally
Allow --stdin to hash any garbage into a loose object which might not otherwise pass standard object parsing or git-fsck checks. Useful
for stress-testing Git itself or reproducing characteristics of corrupt or bogus objects encountered in the wild.
GIT
Part of the git(1) suite
Git 2.17.1 10/05/2018 GIT-HASH-OBJECT(1)