"var" is going to start with arg1 and get reassigned to the next in the list each iteration until argn
"T1" is always going to be arg1
"T2" is always going to be arg2
How can I use a variable that has the conditions for the if statement stored in it?
my test script
condition=" || || "
if "$condition"
then echo "true"
else echo "false"
fi
output
$ ./test2.sh
./test2.sh: line 3: || || : command not found
false (2 Replies)
Hi All,
I am trying to check if two variables have value assigned to it.
i am doing it like
if ]
then
echo "Please specify either single hostname or host file for the report"
usage
exit
fi
But its not working for it.Even i specify values for both variables it dont go... (6 Replies)
Hi, I have meaning to include an if condition statement in my code to check the directory for existing output files and if its existing i want the program to delete it before doing the succeeding command. i just dont know the correct syntax for it. thanks much guys, this forum has indeed been very... (4 Replies)
Urgent help with bash scripting
1- i am using grep to find a string called: tinker panic 0 in a file /etc/ntp.conf
if the string is not there, i want to add the strings in /etc/ntp.conf file in the first line of the file. if not do nothing or exit.
2- also i want to add # in front of the... (2 Replies)
I want to check (using bash condition test function) if string contains three spaces, ignoring last three spaces at the end of string.
string_to_report='foo bar foo bar '
string_to_ignore='foo bar ' (8 Replies)
In the below I can not seem to add a line that will add Not low if the statement in bold is not true or meet. I guess when the first if statement is true/meet then print low, otherwise print Not low in $(NF + 1). I am not sure how to correctly add this. Thank you :).
if(low <= $2 && $2 <=... (5 Replies)
Hi,
I need to perform the untar and rm operation if the file found is a .tar and does not have test.tar or hello.tar as the file names.
Below is the loop to check the same.
for tf in *.tar
do if ]
then found=1
... (1 Reply)
I wrote a code to find codons in a DNA string. The only problem I have is how do I make the code only work for a file with DNA. This means the file only has the characters a,c,g,t and no white space characters. (3 Replies)
Hi.
I wrote this small bash script, i want to compare second column from file1 with file2 if a pattern matches. Files are small and I am sure that pattern occurs only once. I think this can be rewritten into a awk one liner. Appreciate if someone could give me idea. Whole NR FNR confuse me :o
... (6 Replies)
Discussion started by: ctrld
6 Replies
LEARN ABOUT NETBSD
xc_broadcast
XCALL(9) BSD Kernel Developer's Manual XCALL(9)NAME
xcall, xc_broadcast, xc_unicast, xc_wait -- cross-call interface
SYNOPSIS
#include <sys/xcall.h>
typedef void (*xcfunc_t)(void *, void *);
uint64_t
xc_broadcast(u_int flags, xcfunc_t func, void *arg1, void *arg2);
uint64_t
xc_unicast(u_int flags, xcfunc_t func, void *arg1, void *arg2, struct cpu_info *ci);
void
xc_wait(uint64_t where);
DESCRIPTION
The machine-independent xcall interface allows any CPU in the system to request that an arbitrary function be executed on any other CPU.
Sometimes it is necessary to modify hardware state that is tied directly to individual CPUs (such as a CPU's local timer), and these updates
can not be done remotely by another CPU. The LWP requesting the update may be unable to guarantee that it will be running on the CPU where
the update must occur, when the update occurs.
Additionally, it is sometimes necessary to modify per-CPU software state from a remote CPU. Where these update operations are so rare or the
access to the per-CPU data so frequent that the cost of using locking or atomic operations to provide coherency is prohibitive, another way
must be found.
Cross calls help to solve these types of problem. However, since this facility is heavyweight, it is expected that it will not be used
often.
xcall provides a mechanism for making ``low priority'' cross calls. The function to be executed runs on the remote CPU within a thread con-
text, and not from a software interrupt, so it can ensure that it is not interrupting other code running on the CPU, and so has exclusive
access to the CPU. Keep in mind that unless disabled, it may cause a kernel preemption.
xcall also provides a mechanism for making ``high priority'' cross calls. The function to be executed runs on the remote CPU within a
IPL_SOFTCLOCK software interrupt context, possibly interrupting other lower-priority code running on the CPU.
NOTES
Functions being called should be relatively lightweight. They may block on locks, but carefully and minimally, to not interfere with other
cross calls in the system.
FUNCTIONS
xc_broadcast(flags, func, arg1, arg2)
Call (*func)(arg1, arg2) on all CPUs in the system. Return a uint64_t ``ticket'' to xc_wait() on for the cross-call to complete.
flags should be XC_HIGHPRI for a "high priority" call, and 0 for a "low priority" call. xc_broadcast() should not be called from
interrupt context.
xc_unicast(flags, func, arg1, arg2, ci)
Like xc_broadcast(), but call (*func)() on only the CPU indicated by ci. xc_unicast() also returns a ``ticket''.
xc_wait(where)
Wait on the ``ticket'' returned by a prior xc_broadcast() or xc_unicast() for the corresponding cross-call to complete. xc_wait()
should be called from a thread context.
CODE REFERENCES
The xcall interface is implemented within the file sys/kern/subr_xcall.c.
SEE ALSO kpreempt(9), percpu(9)HISTORY
The xcall interface first appeared in NetBSD 5.0.
AUTHORS
Andrew Doran <ad@NetBSD.org>
BSD October 24, 2011 BSD