I don't know how to ask this clearly, so I'll try my best...
At what point does a shell script stop reading from a file, and begin using the buffered script?
Hopefully, this example will shed some light:
#!/usr/bin/ksh
value=""
until ; do
sleep 10
print "What is your value?"
#print... (5 Replies)
Hi All,
I want to read some number from a file into a variable in C shell as follows.
I know that the syntax in ksh is
read x < file name
I dont know what's the equivalent for this in C Shell
Can some one pls. help me out?
Thanks in advance
raju (2 Replies)
Hello
i have a file in directory which has some values like this
lets assume the file is $p
ttry_rtyy_trree
and i am using a file as an input as ($Y) in a shell once i start the shell it should read the file $p and $Y once those lines are matched in $Y i want to take a copy of that ... (7 Replies)
I have to write a C program using sys call (read, no fread) to read from shell all the parameters, without know how many are them.
I tryed in some ways, but I have no success.
Any Idea?
Can I use read to read from stdin? (1 Reply)
Hallo,
i need a Prompting read in my script:
read -p "Enter your command: " command
But i always get this Error:
-p: is not an identifier
When I run these in c-shell i get this error
/usr/bin/read: read: bad option(s)
How can I use a Prompt in the read command? (9 Replies)
Hello All,
I have a an application written in C and runing on Red Hat Linux.
In my code I have written a command that is fired on the linux shell by using system() function call.
Now I need to read the output of this command in my c program and assign it to a variable.
Can anyone... (1 Reply)
Hi all,
I am using csh to read a line from the terminal. I was told to use $< like the following in the terminal:
set name = $<
then I write a line:
James Bond
then I look at the value of 'name':
echo $name
it is always 'James'.
Although the textbook tells me that $< read a... (2 Replies)
Guys,
I have a requirement like below
my cfg file(sam.cfg) has
path=/u/sample/test/
path=/u/sample1/test1/
path=/u/sample2/test2/
days=10
file=*.log
My script is below,
#!/bin/sh
./u/sample/sam.cfg
while read line
do
find $path -name "$file" -mtime +$days -exec ls -la... (2 Replies)
.... Solved....
..
..
Hello,
I've read couples of similar threads to my question and I strongly believe that I am doing something wrong. What I'm trying to do is to process data with php. It reads data from shell script.
Everything goes well but at the end it does not print what it reads... (0 Replies)
Discussion started by: baris35
0 Replies
LEARN ABOUT REDHAT
endpwent
GETPWENT(3) Linux Programmer's Manual GETPWENT(3)NAME
getpwent, setpwent, endpwent - get password file entry
SYNOPSIS
#include <pwd.h>
#include <sys/types.h>
struct passwd *getpwent(void);
void setpwent(void);
void endpwent(void);
DESCRIPTION
The getpwent() function returns a pointer to a structure containing the broken out fields of a line from /etc/passwd. The first time it is
called it returns the first entry; thereafter, it returns successive entries.
The setpwent() function rewinds the file pointer to the beginning of the /etc/passwd file.
The endpwent() function closes the /etc/passwd file.
The passwd structure is defined in <pwd.h> as follows:
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* user password */
uid_t pw_uid; /* user id */
gid_t pw_gid; /* group id */
char *pw_gecos; /* real name */
char *pw_dir; /* home directory */
char *pw_shell; /* shell program */
};
RETURN VALUE
The getpwent() function returns the passwd structure, or NULL if there are no more entries or an error occurs.
ERRORS
ENOMEM Insufficient memory to allocate passwd structure.
FILES
/etc/passwd
password database file
CONFORMING TO
SVID 3, BSD 4.3
SEE ALSO fgetpwent(3), getpwnam(3), getpwuid(3), getpw(3), putpwent(3), passwd(5)GNU 1996-05-27 GETPWENT(3)