It's achieved in the shell by using a shell. C isn't a shell, and a file really isn't a variable, you often don't know how long it is... You have to convert yourself and worry about any special cases yourself.
So write function. Quick and dirty:
Last edited by Corona688; 10-18-2010 at 03:15 PM..
Reason: better return value
"Is there any substituation of last command or script syntax which can be used as a user. As far I know the "last" command is being used to display information about previous logins. A member of adm group or the user adm can execute it only.
Thanks in advance for your usual help.
Ghazi (6 Replies)
Hi,
i want to write a script that executes a program (exec?) .
this program then requires a filename as input.
how do i give it this input in the script so the program will be complete run and close by the script.
e.g.
exec prog.exe
program then asks for filename
"enter filename:"... (1 Reply)
Hi,
What is the actual difference between these two? Why the following code works for process substitution and fails for command substitution?
while IFS= read -r line; do echo $line; done < <(cat file)executes successfully and display the contents of the file
But,
while IFS='\n' read -r... (3 Replies)
Hey, I was trying to figure out how to launch a program from the command line, and it works if you pass it a config file. I was thinking about writing a script to dynamically create the config file and pass it to the command using something like command substitution (so I don't actually have to... (3 Replies)
I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename?
#!/bin/bash
filename=`echo $0`
/usr/bin/sed '/#include/ {
i\
the filename is `$filename`
}' $1
exit 0 (8 Replies)
Hey, guys!
Trying to research this is such a pain since the read command itself is a common word. Try searching "unix OR linux read command examples" or using the command substitution keyword. :eek:
So, I wanted to use a command statement similar to the following.
This is kinda taken... (2 Replies)
Hi,
I almost always use back quotes in scripts to assigin output of a command to a variable.
eg: file=`basename a/b/c/d/file`
year_mon=`date +%Y%m`
But the same can be achieved like:
file=$(basename a/b/c/d/file)
year_mon=$(date +%Y%m)
I would like to know if there is... (3 Replies)
I have the following code:
strfuture=abcdefghi
ver=${strfuture:${count}:1}
mj7777_ver=${ver} start_mj7777_iteration
let count=count+1
When it is executed I get bad substitution. The same if I use
ver=${strfuture:$count:1}
mj7777_ver=${ver}... (6 Replies)
Oracle Linux 5.6, 64-bit
Given the following snippet
wrkvar=`sqlplus -s / as sysdba <<EOF
set echo off feedback off head off trimsp on
select count(*) from v\$parameter
where name in ('db_file_name_convert','log_file_name_convert')
and value is not null;
EOF`
echo wrkvar=$wrkvarProduces... (2 Replies)
Hi folks,
I totally dislike asking questions in forums but this one eats up to much of my time I need to spend on other topics.
I have a shell-script in which I call a terminal.
I want to invoke bash inside the terminal and print a message inside bash with aid of a here document.
See... (7 Replies)
Discussion started by: bluntroller
7 Replies
LEARN ABOUT DEBIAN
ldns_wire2rdf
ldns(3) Library Functions Manual ldns(3)NAME
ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf, ldns_wire2dname-
SYNOPSIS
#include <stdint.h>
#include <stdbool.h>
#include <ldns/ldns.h>
ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section);
ldns_wire2pkt();
ldns_status ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos);
ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos);
DESCRIPTION
ldns_wire2rr() converts the data on the uint8_t bytearray (in wire format) to a DNS resource record. This function will initialize and
allocate memory space for the rr structure. The length of the wiredata of this rr is added to the *pos value.
rr: pointer to the structure to hold the rdata value
wire: pointer to the buffer with the data
max: the length of the data buffer (in bytes)
pos: the position of the rr in the buffer (ie. the number of bytes
from the start of the buffer)
section: the section in the packet the rr is meant for
Returns LDNS_STATUS_OK if everything succeeds, error otherwise
ldns_wire2pkt()
ldns_wire2rdf() converts the data on the uint8_t bytearray (in wire format) to DNS rdata fields, and adds them to the list of rdfs of the
given rr. This function will initialize and allocate memory space for the dname structures. The length of the wiredata of these
rdfs is added to the *pos value.
All rdfs belonging to the RR are read; the rr should have no rdfs yet. An error is returned if the format cannot be parsed.
rr: pointer to the ldns_rr structure to hold the rdata value
wire: pointer to the buffer with the data
max: the length of the data buffer (in bytes)
pos: the position of the rdf in the buffer (ie. the number of bytes
from the start of the buffer)
Returns LDNS_STATUS_OK if everything succeeds, error otherwise
ldns_wire2dname() converts the data on the uint8_t bytearray (in wire format) to a DNS dname rdata field. This function will initialize and
allocate memory space for the dname structure. The length of the wiredata of this rdf is added to the *pos value.
dname: pointer to the structure to hold the rdata value
wire: pointer to the buffer with the data
max: the length of the data buffer (in bytes)
pos: the position of the rdf in the buffer (ie. the number of bytes
from the start of the buffer)
Returns LDNS_STATUS_OK if everything succeeds, error otherwise
AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben.
REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html
COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs.
Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire, ldns_dname2wire. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035.
REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl.
30 May 2006 ldns(3)