This statement means that if there is no gene2 then there cannot be a gene3 read:
Code:
[ -z "$gene2" ] && continue
When you use the read statement you have to have all fields there in order to get gene3.
Otherwise gene3 is an "empty" variable. Or the same can happen for gene2.
You can create dummy values for those variables if they are empty, but since you have a separate script processing things that could affect the output of that script.
Try creating an intermediate file with dummy variables, let's use the word 'dummy' for the values of empties. This is awk, the output file will be called tmp.tmp which is what your script will have to use for input.
This could also be set up writing to a pipe which your existing script reads.
Code:
awk '{
# check to see what type of line we have,
# if col 1 is a number then we have to play the dummy game
if( int($1) !=0)
{
if(NF==6) { $7="dummy"; $8="dummy" }
if(NF==7) { $8="dummy" }
}
print $0
}' inputfile > tmp.tmp
So the last 2 fields in tmp.tmp can be a real value, or just fiber filler: "dummy", but there will always be 8 fields. The last two fields cannot be blank or bash will not read them into a variable.
If no arguments are entered I wanna be able to read 2 arguments, i have done like this but it doesnt work:
x=0
until #loop starts
do
if ; then
echo No arguments were entered, please enter 2 arguments.
read $1 $2
elif || ; then
echo $#... (0 Replies)
Hi,
I'm trying to write a script that reads filenames from a file and use these filenames in a loop. The filenames are all on one line and the problem is that these filenames have wildcards like * and braces like in them.
Right now what I'm doing is something like this:
echo "reading from... (0 Replies)
Hi.
I have the script shown below. If I execute it form the command line it seems to work properly, but when I fun it using the unix "at" command
"at -m now < ./kill-at-job.sh"
It appears to hang. Below is the script, the input file, and the execution as reported in the e-mail from the "at"... (3 Replies)
i get a name from user first name : last name, in this format. Now i am saving this to a file. what i want is, I do not want to save any name if I already have one entry o that same name..what should i do
for example
user give robert fernandez
this will save in file as robert:fernandez.
if... (5 Replies)
Hi All,
I am trying to read a .csv file which has some 6 columns.
Eg: samp.csv
one, two, three, four
six, seven, eight, nine
I used the following code,
for line in `cat samp.csv`
do
echo "$line"
done
It displays every comma seperated values in each line like,
one,... (1 Reply)
I have a file that has four values on each line and I'd like to give each column a variable name and then use those values in each step of a loop. In bash, I believe you could use a while loop to do this or possibly a cat command, but I am super new to programming and I'm having trouble decoding... (2 Replies)
I have the following code and I am calling it using
./raytrac.bash -u
and getting problems. For some reason opt_usage is still 0.
opt_usage=0
iarg=0
narg=$#
while (($iarg < $narg))
do
(( iarg = $iarg + 1 ))
arg=$argv
usrInputFlag=`echo $arg | awk '/=/ {print 1}; ! /=/... (22 Replies)
I've a file in linux with following text:
;ip address hostname put-location alt-put-location tftpserver
192.168.1.1 r01-lab1-net /mnt/nas1/fgbu/ /opt/fgbu/devicebackup 192.168.1.254Now I want to read these values and assign them to particular variables... (6 Replies)
Hi all,
Given here under a section of a script I am using.
SIMDIR="/home/Ins/forces"
cd $SIMDIR
for file in `ls *.forces`
do
basename=`echo $file | sed 's/\.*$//'`
extname=`echo $file | sed 's/*\(*\)\.\(.*\)/\2\1/'`
echo "Processing file: "$basename
python convert.py... (4 Replies)
Cope sample1: test.sh
i=0
echo " Outside loop i = $i "
while
do
i=$(( $i + 1))
echo "Inside loop i = $i "
done
echo " Out of loop i is : $i "
When run output :
Outside loop i = 0
Inside loop i = 1
Inside loop i = 2
Inside loop i = 3
Inside loop i = 4
Inside loop i = 5
Inside... (8 Replies)
Discussion started by: Adarshreddy01
8 Replies
LEARN ABOUT DEBIAN
dummy-ups
DUMMY-UPS(8) NUT Manual DUMMY-UPS(8)NAME
dummy-ups - Driver for multi-purpose UPS emulation
NOTE
This man page only documents the specific features of the dummy-ups driver. For information about the core driver, see nutupsdrv(8).
DESCRIPTION
This program is a multi-purpose UPS emulation tool. Its behavior depends on the running mode:
Dummy Mode
dummy-ups looks like a standard device driver to upsd(8) and allows one to change any value for testing purposes. It is both interactive,
controllable through the upsrw(1) and upscmd(1) commands (or equivalent graphical tool), and batchable through script files. It can be
configured, launched and used as any other real driver. This mode is mostly useful for development and testing purposes.
Repeater Mode
dummy-ups acts as a NUT client, simply forwarding data. This can be useful for supervision purposes. This can also allow some load sharing
between several UPS instances, using a point-to-point communication with the UPS.
IMPLEMENTATION
The port specification depends on the running mode, and allows the driver to select the right mode.
Dummy Mode
Port is a definition file name for dummy-ups. This can either be an absolute or a relative path name. In the latter case the NUT sysconfig
directory (ie /etc/nut, /usr/local/ups/etc, ...) is prepended.
For instance:
[dummy]
driver = dummy-ups
port = evolution500.dev
desc = "dummy-ups in dummy mode"
This file is generally named "something.dev". It contains a list of all valid data and associated values, and has the same format as an
upsc(8) dump (<varname>: <value>). So you can easily create definition files from an existing UPS using "upsc > file.dev". It can also be
empty, in which case only a basic set of data is available: device., driver., ups.mfr, ups.model, ups.status
Samples definition files are available in the "data" directory of the nut source tree, and generally in the sysconfig directory of your
system distribution.
Since dummy-ups will loop on reading this file, you can dynamically modify it to interact with the driver. This will avoid message spam
into your system log files, if you are using NUT default configuration.
You can also use the "TIMER <seconds>" instruction to create scheduled events sequences. For example, the following sequence will loop on
switching ups.status between "OL", "OB" and "OB LB" every minute:
ups.status: OL
TIMER 60
ups.status: OB
TIMER 60
ups.status: LB
TIMER 60
It is wise to end the script with a TIMER. Otherwise dummy-ups will directly go back to the beginning of the file.
Repeater Mode
Port is the name of a remote UPS, using the NUT form, ie:
<upsname>[@<hostname>[:<port>]]
For instance:
[repeater]
driver = dummy-ups
port = ups@hostname
desc = "dummy-ups in repeater mode"
INTERACTION
Once the driver is loaded in dummy mode, you can change any variables, except those of the driver.* and server.* collections. You can do
this by either editing the definition file, or use the upsrw(1) and upscmd(1) commands.
Note that in simulation mode, new variables can be added on the fly, by adding these to the definition file. Conversely, if you need to
remove variable (such as transient ones, like ups.alarm), simply update these by setting an empty value. As a result, they will get removed
from the data.
In repeater mode, the driver acts according to the capabilities of the UPS, and so support the same instant commands and settable values.
BACKGROUND
This driver was written in one evening to replace the previous dummycons testing driver. It was too limited and required to work from a
terminal to interact.
dummy-ups is useful for NUT client development, and other testing purpose.
It also helps the NUT Quality Assurance effort, by automating some tests on the NUT framework.
It now offers a repeater mode. This will help in building the Meta UPS approach, which allows one to build a virtual device, composed of
several other devices (either UPS, PDUs).
BUGS
Instant commands are not yet supported in Dummy Mode, and data need name/value checking enforcement, as well as boundaries or enumeration
definition.
AUTHOR
Arnaud Quette
SEE ALSO upscmd(1), upsrw(1), ups.conf(5), nutupsdrv(8)
Internet Resources:
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
Network UPS Tools 05/21/2012 DUMMY-UPS(8)