The following does not work as intended:
Perhaps the input is DOS format, and you want to convert \r and \n to space; then the following might work better
In tr the string1 can ccontain more than one character; then string2 should have more than one character (here: two spaces) to allow a one-to-one mapping (otherwise different tr versions produce different results).
Last edited by MadeInGermany; 01-06-2020 at 07:53 AM..
Reason: removed outer quotes - csh has a parser error with "`" "`"
I am trying to run the following code from a script file but it complains that syntax of (both instances of) grep is wrong.
When I copy and paste it to the terminal, it is OK. Any idea what the problem might be?
set i = `grep -c #define flags.h`
while ($i>20)
@ i--
my func (`cat... (4 Replies)
Howdie everyone...
I have a shell script RemoveFiles.sh
Inside this file, it only has two commands as below:
rm -f ../../reportToday/temp/*
rm -f ../../report/*
My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Hi everyone,
I have a Linux OS in my PC (older version 9). Its default shell is bash. Whenever I try to run some Perl program it throws error ! eg, if I run this simple PERL program ,
#!/usr/bin/perl
printf "\lHello \n";
$var=3 ;
printf $var;
@list=(1,2,3);
printf "@list";... (6 Replies)
Hello,
Unfortunately I don't found any working solution for my problem :/
I have pass file for dovecot authorizing in this format:
user@domain.tld:{SSHA}Ykx2KVG/a2FKzjnctFFC2qFnrk9nvRmW:5000:5000::::
.
.
...Now, I want to write some sh script for password changing for grep'ed user, in... (5 Replies)
Hello all,
Something strange going on with a shell script I'm writing. It's trying to write a list of files that it finds in a given directory to another file. But I also have a skip list so matching files that are in that skip list should be, well uhm, skipped :)
Here's the code of my... (2 Replies)
Linux version : Oracle Linux 6.4
Shell : Bash
The following script will be run as root. During the execution, it should switch to oracle user and execute few commands.
After googling and searching within unix.com , I came up with the following syntax
## Enclosing all commands in double... (7 Replies)
Hello
I have a shell script that is run as root. Script rins ok until the point where it have to switch to user "mqm" to run other commands. It just hangs at the point of this line in the script
su - mqm -c "dspmq"
I ran the same commands at the terminal and they run fine.
Any thoughts. (6 Replies)
I have below code inside my awk script
if ( $0 ~ /SVC IN:/ )
{
svc_in=substr( $0,23 , 3);
if (msg_start == 1 && msg_end == 0)
{
msg_arr=$0;
}
}
else if ( $0 ~ /^SVC OUT:/ )
{
svc_out=substr( $0, 9, 3);
if (msg_start == 1 && msg_end == 0)
... (6 Replies)
Discussion started by: bhagya123
6 Replies
LEARN ABOUT NETBSD
dofilewrite
DOFILEREAD(9) BSD Kernel Developer's Manual DOFILEREAD(9)NAME
dofileread, dofilereadv, dofilewrite, dofilewritev -- high-level file operations
SYNOPSIS
#include <sys/file.h>
int
dofileread(struct lwp *l, int fd, struct file *fp, void *buf, size_t nbyte, off_t *offset, int flags, register_t *retval);
int
dofilewrite(struct lwp *l, int fd, struct file *fp, const void *buf, size_t nbyte, off_t *offset, int flags, register_t *retval);
int
dofilereadv(struct lwp *l, int fd, struct file *fp, const struct iovec *iovp, int iovcnt, off_t *offset, int flags, register_t *retval);
int
dofilewritev(struct lwp *l, int fd, struct file *fp, const struct iovec *iovp, int iovcnt, off_t *offset, int flags, register_t *retval);
DESCRIPTION
The functions implement the underlying functionality of the read(2), write(2), readv(2), and writev(2) system calls. They are also used
throughout the kernel as high-level access routines for file I/O.
The dofileread() function attempts to read nbytes of data from the object referenced by file entry fp into the buffer pointed to by buf. The
dofilewrite() function attempts to write nbytes of data to the object referenced by file entry fp from the buffer pointed to by buf.
The dofilereadv() and dofilewritev() functions perform the same operations, but scatter the data with the iovcnt buffers specified by the
members of the iov array.
The offset of the file operations is explicitly specified by *offset. The new file offset after the file operation is returned in *offset.
If the FOF_UPDATE_OFFSET flag is specified in the flags argument, the file offset in the file entry fp is updated to reflect the new file
offset, otherwise it remains unchanged after the operation.
The file descriptor fd is largely unused except for use by the ktrace framework for reporting to userlevel the process's file descriptor.
Upon successful completion the number of bytes which were transferred is returned in *retval.
RETURN VALUES
Upon successful completion zero is returned, otherwise an appropriate error is returned.
CODE REFERENCES
The framework for these file operations is implemented within the file sys/kern/sys_generic.c.
SEE ALSO file(9)BSD December 20, 2005 BSD